All API endpoints are rate limited. Exceeding 10 requests from a single IP in a 5 second period will result in the following response for the remainder of the 5 second period:
{"warning":"You have been rate-limited"}

URLs

/tk102/api/last_position

https://www.philcrump.co.uk/tk102/api/last_position?imei=0011223344556677889900

/tk102/api/packets

Response Errors

We hope you won't see many of these, but the ones that currently exist are:
{"error":"No IMEI in Request"}
{"error":"Error connecting to database"}

Client Examples

Javascript

Using JQuery. Look at youmightnotneedjquery.com for pure javascript ajax functions supporting various levels of browser compatibility.

$.ajax({
    url: "https://www.philcrump.co.uk/tk102/api/last_position",
    type: "GET",
    data: {
        imei: imeiVar
    },
    dataType: 'json',
    success: function( data )
    {
        if(data.error)
        {
            // Error
            // data.error
        }
        else if(data.warning)
        {
            // Warning!
            // data.warning
        }
        else
        {
            // Success!
            // data.ts, data.lat, data.lon, etc.
        }
    }
});

Python 2


from urllib2 import urlopen
from json import load

api_json = urlopen('https://www.philcrump.co.uk/tk102/api/last_position?imei=' + str(imei_number))
api_response = load(api_json)
if 'error' in api_response:
    # Error!
elif 'warning' in api_response:
    # Warning!
else:
    # Success