Loggr Web API
The Loggr Web API enables you to query your log's events and other meta-data about your Loggr account. The API makes it easy to create web and desktop applications that integrate with your account.
Since the API is based on HTTP principles, it's very easy to write and test applications. You can use your browser to access URLs, and you can use pretty much any HTTP client in any programming language to interact with the API.
Some possible ideas for using our API:
- Pull event information into your own apps
- Create a client application taylored to your business or your client's business
- Create a custom dashboard using apps like Geckoboard or Ducksboard
- Integrate Loggr with your backend systems like support and CRM
Base URL
The Loggr Web API has a single point of entry. All URLs referenced in the documentation have the following base:
HTTP
Currently the Loggr Web API only supports HTTP. We do not support SSL with our API.
Authentication
All calls to our API require the caller to authenticate. See
Authentication for specifics.
Requests
Requests are made over HTTP. We support GET, POST, PUT and DELETE methods. Below is a simple example of getting the lastest event from your log "testlog".
curl -d "joe@sample.com:password"
"http://api.loggr.net/1/logs/testlog/events?order=desc&pagesize=1"
Command Line
Responses
Each call will have a slightly different response. Here is the response from the previous request. (See the documentation for each resource to know what response to expect for each resource call).
< HTTP/1.1 200 OK
< Cache-Control: no-cache
< Pragma: no-cache
< Transfer-Encoding: chunked
< Content-Type: application/json; charset=utf-8
< Expires: -1
< Date: Thu, 18 Aug 2011 17:13:11 GMT
<
[{"text":"Testing","link":"","hash":"OWO17VuTXKUfvxbGUKMuIQ==",
"tags":["fatal"],"source":"WEB-04","log":"testlog",
"user":"joe@sample.com","filter":null,"class":null,"bookmarks":[],
"data":true,"id":"4e4a4aa54e1feb016432118f","alerts":null,
"geo":null,"value":null,"created":"\/Date(1313491621070)\/"}]
Response Formats
Loggr can response to your requests with various formats. By default the response will be JSON as shown in the previous response example.
The API inspects the HTTP Accept header to determine the response format to use. Here's an example for returning XML.
curl -d "joe@sample.com" -H "Accept:text/xml"
"http://api.loggr.net/1/logs/testlog/events?order=desc&pagesize=1"
Command LineWhich will yield the following response.
< HTTP/1.1 200 OK
< Cache-Control: no-cache
< Pragma: no-cache
< Transfer-Encoding: chunked
< Content-Type: text/xml; charset=utf-8
< Expires: -1
< Date: Thu, 18 Aug 2011 17:13:11 GMT
<
<results><event><id>4e4a4aa54e1feb016432118f</id><text>Testing</text>
<link /><hash>OWO17VuTXKUfvxbGUKMuIQ==</hash><tags><tag>fatal</tag></tags>
<source>WEB-04</source><log>testlog</log><user>joe@sample.com</user>
<data>true</data><created>2011-08-16T10:47:01.07Z</created></event></results>
We currently support two formats within the Accept header:
| Header | Format |
| application/json | JSON (default) |
| text/xml | XML |
In an attempt to make things a little more flexible, we offer an alternative way to specify the response format (plus a little extra). Just tack "?fmt=XXX" on the end of your request and we will set the response format based on the XXX.
| fmt Value | Format |
| json | JSON (default) |
| xml | XML |
| jsonp | JSONP |
Resources
Loggr exposes most of it's functionality though the Web API's resource. You can see them all on the
Resources page.