Query

With the Query endpoint, we provide an easy way to grab the events in your log. By using the Loggr Query Language you can make a single call to get individual events or aggregated data about the events.

URL

GET /logs/{logkey}/query?query=[lql]

Request

// This example returns the text field for last 5 events that were posted 

GET /logs/foo/query?query=GET%20events%20TAKE%205%20SORT%20created%20DESC%20OCCURS(TODAY)%20COLUMNS(text)

You will need to URL encode the actual query for it to work. See the Loggr Query Language page for more details on queries you can use.

Response

If your request does not do any grouping, you will get an array of events back, like:

Status: 200 OK

[
    {
        "id":"4dfdff994e1feb0b4c0020ef",
        "created":"\/Date(1308491673911)\/",
        "text":"A user was created",
        "link":"",
        "hash":"LiWqANduFe+cia1nMTfN+g==",
        "tags":["user","created"],
        "source":"web3",
        "log":"sample"
        "class":"created",
        "data":true,
        "geo":null,
        "value":null
    }
]

If your request does grouping, you will get an array of aggregate info like below. Notice that the results are for a query that groups by DAY so the key will be a date.

Status: 200 OK

[
    {
        "key":"9/19/2011",
        "count":"10",
        "avg":"83",
        "sum":"157",
        "min":"28",
        "max":"224"
    }
]