ruby-on-railsrubyapiairbrakeerrbit

how to call the Errbit API?


Starter

Airbrake/Errbit are applications that collect errors generated by other applications, and aggregate the results for review. Airbrake is a commercial app and Errbit is an open-source clone of Airbrake.

Main Course

I need some help figuring out the Errbit API. I'm not talking about the API that you use to send errors to Errbit, but Errbit (and Airbrake) have another API that you use to read data back out of it. The Airbrake API is reasonably well documented, but there are no docs for the Errbit API. I posted a question about their API to the Errbit Google Group, and was told:

I had a look at the code, but being a non-Rubyist, I couldn't make much sense of it.

All I want to do, is get the total number of errors for a particular app (project). If it's only possible to get all the errors, then I could just filter out the errors for the project of interest in the API client.

Could someone familiar with Rails apps, see if the API supports this, and if so, explain how I can invoke it (what URL and params should I use)?


Solution

  • From what I can see you just need to do a GET request to

    /api/v1/stats/app?api_key=XXXXXX
    

    Where XXXXX is the api key of the app you want to get the params for. This call will return a json wit the following information:

    stats = {
      :name => @app.name,
      :last_error_time => @last_error_time,
      :unresolved_errors => @app.unresolved_count
    }
    

    If you need more information you can always modify the file: /app/controllers/api/v1/stats_controller.rb to include the relevant information