API Documentation

Notifier API

The Notifier API is used to send exception and error data to our service. It is used in our Ruby (Ruby on Rails) and PHP (+ Zend Framework) exception notifier plugins — feel free to implement your own notifiers in your language of choice.

General

The API-namespace to use is https://exceptiontrap.com/api/notifier/v1 (you can use http too). As you can see, the current API version is 1.0.

All data sent must be in JSON format.

Authentication is handled by sending your API key as a HTTP header field named x-api-key. Your API key can be found by logging into your Exceptiontrap account, selecting the project and clicking the "Setup" link at the top.

Send a problem / error / exception

You can send errors and exceptions via /problems.json. See a sample request and the accepted attributes here:

POST /problems.json
Content-type: application/json
x-api-key: b17a27b3f141c69d7552
{
  "problem": {
    "name": "SyntaxError",
    "message": "/app/controllers/home_controller.rb:5: syntax error, unexpected tIDENTIFIER, expecting keyword_end",
    "location": "HomeController(5)",
    "request_params": {
      "q": "foo",
      "me": "too",
      "...": "..."
    },
    "request_remote_ip": "",
    "request_session": {
      "session_id": "BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTAzMWRiNTExOTU0Mj",
      "user_credentials": "111814c12f51436e52d94fa224240fc9328e0f0ef3abd2cb17e21a597",
      "...": "..."
    },
    "request_uri": "",
    "root": "/srv/apps/rails-sample",
    "trace": [
      "activesupport (3.2.9) lib/active_support/dependencies.rb:454:in `load'",
      "activesupport (3.2.9) lib/active_support/dependencies.rb:454:in `block in load_file'",
      "activesupport (3.2.9) lib/active_support/dependencies.rb:593:in `new_constants_in'",
      "..."
    ],
    "app_environment": "production",
    "environment": {
      "HTTP_ACCEPT_CHARSET": "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
      "HTTP_VERSION": "HTTP/1.1",
      "GATEWAY_INTERFACE": "CGI/1.1",
      "SERVER_SOFTWARE": "nginx/latest",
      "SERVER_NAME": "thor",
      "...": "..."
    },
    "request_components": {
      "module": "default",
      "controller": "home",
      "action": "show"
    }
  }
}

A cURL request would look like this (assumed you have the data saved in a file called sample.json):

curl https://exceptiontrap.com/notifier/api/v1/problems.json \
  -X POST --data-binary "@sample.json" \
  -H "Content-type: application/json" \
  -H "x-api-key: b17a27b3f141c69d7552"

The required attributes are:

  • name
  • message

But we would recommend to send all the information available to give you a better experience when you have to resolve the error and want to understand what's going on.

Grouping of the errors is performed on the following attributes

  • name
  • location
  • app_environment
  • request_components (module, controller, action)

Notifier Libraries