Skip to content
This repository was archived by the owner on Mar 24, 2021. It is now read-only.

Read API examples individual events

Oliver Spindler edited this page Mar 27, 2013 · 1 revision

Queries returning individual events are not supported by licensing use cases.

For reference, they might look similar to the following:

// individual events, no grouping, no filter, no period

// /licensing?

{
    "bucket": "licensing",
    "query": {},
    "data": [
        {
            "_timestamp": "2012-12-12T01:01:01+00:00",
            "authorityUrlSlug": "westminster",
            "authorityName": "Westminster", 
            "interaction": "success", 
            "licenceUrlSlug": "temporary-events-notice", 
            "licenceName": "Temporary events notice", 
            "_id": "1237", 
            "type": "success"
        }, 
        {
            "_timestamp": "2012-12-12T01:01:01+00:00",
            "authorityUrlSlug": "camden",
            "authorityName": "Camden", 
            "interaction": "success", 
            "licenceUrlSlug": "temporary-events-notice", 
            "licenceName": "Temporary events notice", 
            "_id": "1235", 
            "type": "success"
        },
        {
            "_timestamp": "2012-12-12T06:01:01+00:00",
            "authorityUrlSlug": "westminster",
            "authorityName": "Westminster", 
            "interaction": "failed", 
            "licenceUrlSlug": "temporary-events-notice", 
            "licenceName": "Temporary events notice", 
            "_id": "1236", 
            "type": "failed"
        }, 
        {
            "_timestamp": "2012-12-12T07:01:01+00:00",
            "authorityUrlSlug": "westminster",
            "authorityName": "Westminster", 
            "interaction": "success", 
            "licenceUrlSlug": "temporary-events-notice", 
            "licenceName": "Temporary events notice", 
            "_id": "1234", 
            "type": "success"
        }
    ]
}


// individual events, no grouping, filtered by date, no period

// /licensing?start_at=2012-12-12T00:00:00&end_at=2012-12-12T03:00:00

{
    "bucket": "licensing",
    "query": {
        "start_at": "2012-12-12T00:00:00",
        "end_at": "2012-12-12T03:00:00"
    },
    "data": [
        {
            "_timestamp": "2012-12-12T01:01:01+00:00",
            "authorityUrlSlug": "westminster",
            "authorityName": "Westminster", 
            "interaction": "success", 
            "licenceUrlSlug": "temporary-events-notice", 
            "licenceName": "Temporary events notice", 
            "_id": "1237", 
            "type": "success"
        }, 
        {
            "_timestamp": "2012-12-12T01:01:01+00:00",
            "authorityUrlSlug": "camden",
            "authorityName": "Camden", 
            "interaction": "success", 
            "licenceUrlSlug": "temporary-events-notice", 
            "licenceName": "Temporary events notice", 
            "_id": "1235", 
            "type": "success"
        }
    ]
}




// individual events, filtered, no grouping, no period

// /licensing?filter_by=authorityUrlSlug:camden

{
    "bucket": "licensing",
    "query": {
        "filter_by": "authorityUrlSlug:camden"
    },
    "data": [
        {
            "_timestamp": "2012-12-12T01:01:01+00:00",
            "authorityName": "Camden", 
            "interaction": "success", 
            "licence_name": "Temporary events notice", 
            "_id": "1235", 
            "type": "success"
        }
    ]
}





// individual events, grouped by authority, no filter, no period

// /licensing?group_by=authorityUrlSlug

{
    "bucket": "licensing",
    "query": {
        "group_by": "authorityUrlSlug"
    },
    "data": {
        "westminster": [
            {
                "_timestamp": "2012-12-12T01:01:01+00:00",
                "authorityName": "Westminster", 
                "interaction": "success", 
                "licence_name": "Temporary events notice", 
                "_id": "1237", 
                "type": "success"
            }, 
            {
                "timestamp": "2012-12-12T06:01:01+00:00",
                "authorityName": "Westminster", 
                "interaction": "failed", 
                "licence_name": "Temporary events notice", 
                "_id": "1236", 
                "type": "failed"
            }, 
            {
                "timestamp": "2012-12-12T07:01:01+00:00",
                "authorityName": "Westminster", 
                "interaction": "success", 
                "licence_name": "Temporary events notice", 
                "_id": "1234", 
                "type": "success"
            }
        ],
        "camden": [
            {
                "timestamp": "2012-12-12T01:01:01+00:00",
                "authorityName": "Camden", 
                "interaction": "success", 
                "licence_name": "Temporary events notice", 
                "_id": "1235", 
                "type": "success"
            }
        ]
    }
}


// individual events, grouped by licence_name, no filter, no period

// /licensing?group_by=licenceUrlSlug

{
    "bucket": "licensing",
    "query": {
        "group_by": "licenceUrlSlug"
    },
    "data": {
        "temporary-events-notice": [
            {
                "_timestamp": "2012-12-12T01:01:01+00:00",
                "authorityUrlSlug": "westminster",
                "authorityName": "Westminster", 
                "interaction": "success", 
                "licenceUrlSlug": "temporary-events-notice", 
                "licenceName": "Temporary events notice", 
                "_id": "1237", 
                "type": "success"
            }, 
            {
                "_timestamp": "2012-12-12T01:01:01+00:00",
                "authorityUrlSlug": "camden",
                "authorityName": "Camden", 
                "interaction": "success", 
                "licenceUrlSlug": "temporary-events-notice", 
                "licenceName": "Temporary events notice", 
                "_id": "1235", 
                "type": "success"
            },
            {
                "_timestamp": "2012-12-12T06:01:01+00:00",
                "authorityUrlSlug": "westminster",
                "authorityName": "Westminster", 
                "interaction": "failed", 
                "licenceUrlSlug": "temporary-events-notice", 
                "licenceName": "Temporary events notice", 
                "_id": "1236", 
                "type": "failed"
            }, 
            {
                "_timestamp": "2012-12-12T07:01:01+00:00",
                "authorityUrlSlug": "westminster",
                "authorityName": "Westminster", 
                "interaction": "success", 
                "licenceUrlSlug": "temporary-events-notice", 
                "licenceName": "Temporary events notice", 
                "_id": "1234", 
                "type": "success"
            }
        ]
    }
}


// individual events, grouped by authority, filtered by date, no period

// /licensing?group_by=authorityUrlSlug&start_at=2012-12-12T00:00:00&end_at=2012-12-12T03:00:00

{
    "bucket": "licensing",
    "query": {
        "group_by": "authorityUrlSlug",
        "start_at": "2012-12-12T00:00:00",
        "end_at": "2012-12-12T02:00:00"
    },
    "data": {
        "westminster": [
            {
                "_timestamp": "2012-12-12T01:01:01+00:00",
                "authorityUrlSlug": "westminster",
                "authorityName": "Westminster", 
                "interaction": "success", 
                "licenceUrlSlug": "temporary-events-notice", 
                "licenceName": "Temporary events notice", 
                "_id": "1237", 
                "type": "success"
            }
        ],
        "camden": [
            {
                "_timestamp": "2012-12-12T01:01:01+00:00",
                "authorityUrlSlug": "camden",
                "authorityName": "Camden", 
                "interaction": "success", 
                "licenceUrlSlug": "temporary-events-notice", 
                "licenceName": "Temporary events notice", 
                "_id": "1235", 
                "type": "success"
            }
        ]
    }
}


Clone this wiki locally