The Hoptoad API
Hoptoad provides easy access to all your data via an XML-based, RESTful API.
There is one prerequisite to using the API: you must have an auth_token. When logged in, you can find your auth_token at the "My Profile" page.
Accessing the API using Ruby
If you are using Ruby, then you can use Active Resource to write a client to easily connect to the API. Here is what it'd look like:
Accessing the API Directly
The API is a normal Rails REST service, and while Ruby is our preferred language, you can use any language you want to query the API.
-
To get the XML for the 25 most recently active errors:
http://your_account.hoptoadapp.com/errors.xml?auth_token=TOKEN
-
To get the XML for the next 25 most recently active errors:
http://your_account.hoptoadapp.com/errors.xml?auth_token=TOKEN&page=2
-
To get the XML for a specific error:
http://your_account.hoptoadapp.com/errors/ERROR-ID.xml?auth_token=TOKEN
Here is the XML for a typical error
Submitting Errors to Hoptoad
If you are using Rails, you can obviously use the hoptoad_notifier plugin . If you are interested in submitting errors from a non-Rails application, you can submit errors directly to hoptoad via HTTP post. For complete details of how to do this, it might be best to look at the notifier source. But here is some basic information to get you started.
To submit an error, make an HTTP POST with the error details to
http://hoptoadapp.com/notices/
The post expects the following parameters:
- api_key — The API key for the project this error is from (required). Get this from the project's page in Hoptoad.
- error_message — The message that describes the error (ie. "undefined method `password' for nil:NilClass").
- backtrace — An array where each element is a line of the backtrace (required, but can be empty).
- request — A hash of the request parameters that were given when the error occurred (required, but can be empty).
- session — A hash of the session data that existed when the error occurred (required, but can be empty).
- environment — A hash of the environment data that existed when the error occurred (required, but can be empty).
Right now, there is specific support for Rails on the server side. So, given a Rails request, and environment, we are pulling Rails specific information out of it, for special display.
To post an array, it is a series of parameters like this:
- backtrace[]=line1
- backtrace[]=line2
To post a hash, it is a series of parameters like this:
- request[HOST]=hostname
- request[parameters][user_id]=10
Hosting Provided By
Service Provided By