GET /driver_work_state_changes/:since

Requests work state changes for drivers visible to the authenticated user which occurred on or after the specified :since parameter. Use this call to retrieve near real-time updates. Pass the latest DeviceTimestamp returned by the previous call with each subsequent call.

Note: This call is only available for the Asset Management system. The time passed in the since parameter may not be more than 1 hour earlier than the current server time or else '413 Request Entity Too Large' will be returned.

Parameters

:since

(required)

Indicates that only driver work state changes generated on or after this date and time should be returned. Pass a date/time as seconds since 1970 or a date/time string in the format YYYYMMDDHHmmss. If the authenticated user's globalisation preferences (see GET account/profile) are passed with this request, the value passed in this parameter should be in the time zone specified by the globalisation preferences. Otherwise the value passed should be UTC.

auth

(required)

The authentication token received in response to the call to POST authentication_credentials or GET authentication_token. Applications should pass the authentication token in the custom "X-auth" HTTP header to avoid passing it in in the query string.

driver_ids

(optional)

A comma separated list of driver identifiers indicating that only driver work state changes for the drivers with the specified identifiers should be returned.

bounded

(optional)

Indicates whether or not to include the bounding driver work state change (the one generated prior to the specified :since parameter). Passing a value of 1, t, or true will result in the bounding work state change being included. NOTE: Including the bounding work state change is substantially slower and should only be requested when absolutely necessary!

include_locations

(optional)

Indicates whether or not to include locations/addesses resolved by reverse-geocoding for the positions that are returned. Passing a value of 1, t, or true will result in locations being included. NOTE: Including locations is substantially slower, and should only be done when absolutely necessary! Where possible, applications should call GET geocoding/location or POST geocoding/coordinates to retrieve locations/addresses when required.

callback

(optional)

Only available for JSON format. If supplied, the response will use JSONP format with a callback of the given name.

date_format

(optional)

Only available for JSON format. If supplied, the response will contain JSON dates serialized in the specified format. 0 = Timestamp with offset e.g. "\/Date(1346080140000+0500)\/". 2 = ISO8601 e.g. "2012-08-27T15:09:00.0000000+05:00". Applications may pass this parameter in the custom "X-DateFormat" custom HTTP header instead of this query parameter.

globalisation

(optional)

The authenticated user's globalisation preferences as received in response to the call to GET account/profile or in the custom "X-Globalisation" HTTP header returned in response to authenticated calls. Applications should pass this back to the server with every call, either in this parameter, or in the the custom "X-Globalisation" HTTP header if automatic conversion of values is required.

Request Content Type

N/A

Response

Returns a maximum of 500 DriverWorkStateChange resources in the requested format. If 500 are returned, it is likely that more data is available and an additional call should be made using the latest DeviceTimestamp that was returned as the since parameter.

Response Content Type

application/json, application/javascript (JSONP), application/xml or text/csv as requested

Give It A Try...

Enter appropriate parameter values then click on the link which appears to try the API call...

Note: You must have JavaScript support enabled in your browser to use this feature.

:since

(required)

auth

(required)

driver_ids

(optional)

bounded

(optional)

include_locations

(optional)

callback

(optional)

date_format

(optional)

globalisation

(optional)

Response format

 

Request Examples

GET /driver_work_state_changes/20110101000000?auth=a78581e7935349c39873812572cda216
GET /driver_work_state_changes/20110101000000.json?auth=a78581e7935349c39873812572cda216
GET /driver_work_state_changes/20110101000000.xml?auth=a78581e7935349c39873812572cda216
GET /driver_work_state_changes/20110101000000.csv?auth=a78581e7935349c39873812572cda216
GET /driver_work_state_changes/20110101000000?auth=a78581e7935349c39873812572cda216&driver_id=8973754b-f084-4ba8-b954-483c6084f607

Response Examples

JSON body:

[{"SystemType":"AssetManagement","EventId":"ea9532ab-a86e-460f-bdc2-01b8cc718733","VehicleId":"03119948-ef50-4b0d-aa88-38f9ed333782","DeviceTimestamp":"\/Date(1296063197000+0000)\/","ReceivedTimestamp":"\/Date(1296063185653+0000)\/","DriverId":"75d97e2b-ae46-403a-8f4c-58b688beb9fc","WorkState":"WORK","Origin":"VEHICLE","DriverOrCoDriver":"Driver"}]

XML body:

<ArrayOfDriverWorkStateChange xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<DriverWorkStateChange SystemType="AssetManagement"  EventId="ea9532ab-a86e-460f-bdc2-01b8cc718733">
		<VehicleId>03119948-ef50-4b0d-aa88-38f9ed333782</VehicleId>
		<DeviceTimestamp UtcOffset="0">2011-01-26T17:33:17Z</DeviceTimestamp>
		<ReceivedTimestamp UtcOffset="0">2011-01-26T17:33:05.653Z</ReceivedTimestamp>
		<DriverId>75d97e2b-ae46-403a-8f4c-58b688beb9fc</DriverId>
		<WorkState>WORK</WorkState>
		<Origin>VEHICLE</Origin>
		<DriverOrCoDriver>Driver</DriverOrCoDriver>
	</DriverWorkStateChange>
</ArrayOfDriverWorkStateChange>

CSV body:

SystemType,EventId,VehicleId,DeviceTimestamp,ReceivedTimestamp,DriverId,WorkState,Origin,DriverOrCoDriver,Position
AssetManagement,a4c519a7-d227-4824-bd0a-cec07183b1aa,a73e7412-82f8-4625-a491-f637f4b8a527,"2012-07-06T06:30:00Z","2012-07-06T06:34:32.71Z",7973bbdd-d98a-4acb-9e96-94394f7db744,DRIVE,VEHICLE,Driver,"{SystemType:AssetManagement,VehicleId:a73e7412-82f8-4625-a491-f637f4b8a527,DeviceTimestamp:2012-07-06T06:30:48Z,ReceivedTimestamp:2012-07-06T06:31:59.623Z,DriverId:7973bbdd-d98a-4acb-9e96-94394f7db744,Odometer:214267.6,Longitude:8.478052,Latitude:50.58051,Speed:2,Heading:281,Altitude:152,Hdop:1,Vdop:1,Pdop:1,Satellites:8,Age:0}"
AssetManagement,a86d3c2e-1e1d-4039-af20-36576649d216,ddf83f82-c6fd-49b7-afa4-61bc2f4ad61f,"2012-07-06T06:30:00Z","2012-07-06T06:36:23.023Z",c737490a-e77d-4ed6-9007-b90f011d8c3d,BREAK_REST,VEHICLE,Driver,