GPS Data Web Service API

Saving / Sending Data

POSTing Data, to make new Data Objects

To create new Data Objects on the server, you can make a POST request to the server. The POST request can be performed at a factory URL. The input data properties are specific to the type of data being created.

PUTting Your Data on the server

Once you have performed a GET request to retrieve some data, you might want to edit it and save the changes back on the server. After making changes (what you can change is specific to each Data Object), you can save these by making a PUT request with the changed data, at the URL from which you retrieved it.

Sometimes it's Read Only

Before your data objects are saved, they are checked for correctness. Only the properties that can be altered are used when saving the object. Many (probably most) of the properties on an object are read-only. You can still submit these properties when PUTting or POSTing objects to the server - they will simply be ignored.

Input Formats

As input data (for PUT or POST requests), we accept the same format as the output: JSON and XML. Additionally, for simple data objects (objects that do not contain other objects, nor do they contain a list of objects), we can also accept the ubiquitous application/x-www-form-urlencoded format (standard HTML forms).

However, some objects (namely, Geozones) require a more complex format that cannot be expressed with the application/x-www-form-urlencoded data type. So, you'll need to use our ad-hoc XML format or JSON to input data for those.

Both HTTP requests below are interpreted the same:

PUT /rest/v2/sample HTTP/1.0
Host: mygink.com
Accept: application/json
Cookie: token=[token]
Content-type: application/json
Content-length: 463

{
    "ts": 1508204946,
    "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"
    }
}
PUT /rest/v2/sample HTTP/1.0
Host: mygink.com
Accept: application/xml
Cookie: token=[token]
Content-type: application/xml
Content-length: 639

<?xml version="1.0" encoding="utf-8"?>
<root type="object">
  <ts>1508204946</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>