Once a trip is in progress, we consider the GPS updates as realisation points. The most recent information from your “tracking device”, as mentioned earlier, should be delivered to our platform as often as possible.
So, now we are going to send GPS update to the platform. Of course we made sure first that the tracking device is already known within the Simacan platform. As the format for this second endpoint is in XML we should stick to the validation schema.
Make sure that the payload is valid, by looking at the realisation schema definition. Your XML should look like the following snippet:
<realisation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://api.transportcloud.io/schemas/carrier/v1/realisation"> <tripRealisation xmlns=""> <externalDeviceId>1234</externalDeviceId> <timestamp>2020-06-19T10:11:20.643+00:00</timestamp> <heading>170</heading> <speed>84</speed> <x>5.405911</x> <y>52.192080</y> </tripRealisation> </realisation>
In this example we use the same externalDeviceId as is known on the Simacan platform. The current timestamp, x/y for the longitude/latitude, speed in kilometers and heading (where 0 is north).
This example only works, if you obtained a bearer token from our Auth API. Include this in the header. Here we post to the production URL
curl -X POST \ https://sct-tracking-data-api.services.simacan.com/api/v1/realisation \ -H "Authorization: Bearer eyXXX" \ -H "Content-Type: application/xml" \ -d "<realisation xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://api.transportcloud.io/schemas/carrier/v1/realisation\"> <tripRealisation xmlns=\"\"> <externalDeviceId>1234</externalDeviceId> <timestamp>2020-06-19T10:11:20.643+00:00</timestamp> <heading>170</heading> <speed>84</speed> <x>5.405911</x> <y>52.192080</y> </tripRealisation> </realisation>"
Once you receive an HTTP status code 200 OK, then you’ve just made sure that you are ready to send all your updates to our platform.
Great! You are totally set to send tracking data updates for specified tracking devices
For a more detailed reference in the SCT Tracking Data API, visit our API Marketplace