GPS Data Web Service API

Retrieving Data

GETting Your Data

You can access the data from your GPS trackers (and other types of data) by making an HTTP GET request at its address.

GET /rest/v2/the-data-address HTTP/1.0
Host: mygink.com
Accept: application/json

For every successful HTTP request you make, a data object will be returned. You need to check the HTTP Status Code to see if your request was successful. Many HTTP libraries do this for you. Check the documentation for your programming language & HTTP library for details.

Your Data Object, Formatted

The data object you request can be retrieved in two machine-readable formats: XML and JSON. Additionally, the data is browseable as HTML, but the current output format is not guaranteed to be stable - it is merely a convenience to view data objects directly in your browser.

You can declare the type of formatting you prefer by using the HTTP Accept header. Additionally, you may specify the format explicitly in the URL via the "_format" parameter. If you do this, the HTTP Accept header is ignored.

Sample request for JSON data

Here is what a sample request for the data as JSON looks like.

GET /rest/v2/sample HTTP/1.0
Host: mygink.com
Accept: application/json
HTTP/1.0 200 OK
Date: Tue, 22 Aug 2017 10:59:48 GMT
Content-type: application/json
Content-length: 463

{
    "ts": 1503399588,
    "url": "sample\/url\/",
    "trips": [
        {
            "drive_t": "02:33:08",
            "drive_dist": 187.8992
        },
        {
            "drive_t": "01:04:00",
            "drive_dist": 93.223
        },
        {
            "drive_t": "00:23:50",
            "drive_dist": 60.2523
        }
    ],
    "driver": {
        "name": "Slartibartfast",
        "occupation": "Fjord Designer",
        "speed": "R17"
    }
}

Sample request for XML data

Here is the same request as above, but with the HTTP client requesting XML data instead.

GET /rest/v2/sample HTTP/1.0
Host: mygink.com
Accept: application/xml
HTTP/1.0 200 OK
Date: Tue, 22 Aug 2017 10:59:48 GMT
Content-type: application/xml
Content-length: 639

<?xml version="1.0" encoding="utf-8"?>
<root type="object">
  <ts>1503399588</ts>
  <url>sample/url/</url>
  <trips type="array">
    <item type="object">
      <drive_t>02:33:08</drive_t>
      <drive_dist>187.8992</drive_dist>
    </item>
    <item type="object">
      <drive_t>01:04:00</drive_t>
      <drive_dist>93.223</drive_dist>
    </item>
    <item type="object">
      <drive_t>00:23:50</drive_t>
      <drive_dist>60.2523</drive_dist>
    </item>
  </trips>
  <driver type="object">
    <name>Slartibartfast</name>
    <occupation>Fjord Designer</occupation>
    <speed>R17</speed>
  </driver>
</root>