For this example I’m using Postman, however you are free to use any tool you are comfortable with. Download the collection file below to get started right away.
We have multiple environments, depending on where your solution is hosted you need one of the below endpoints:
Environment | Endpoint |
staging | https://fleetmanagement-api.staging.gpscockpit.net/ |
clust02 (Europe/USA) | https://fleetmanagement-api-clust02.gpscockpit.com/ |
clust03 (KSA) | https://fleetmanagement-api-clust03.gpscockpit.com/ |
clust04 (UAE) | https://fleetmanagement-api-clust04.gpscockpit.com/ |
clust05 (OMN) | https://fleetmanagement-api-clust05.gpscockpit.com/ |
- Example 1a: Authenticate using token
- Example 1b: Authenticate using password
- Example 2: Get assets
- Example 3: Get a single asset by ID
- Example 4: Get a trips between certain date and time
- Example 5: Get distance travelled summary between certain date and time
- Example 6: Update asset properties
- Example 7: Assign driver to asset
- Example 8: Request location updates of your fleet
- Example 9: Request message history for a vehicle
- Example 10: Search for vehicle
Example 1a: Authenticate using token
Get authenticated using token. A (refresh) token can be generated in Fleet Management or request a token through support.
The response will contain a token to be used for subsequent API calls.
Request
POST /api/Authentication/FromRefreshToken HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
{
"RefreshToken": "ABCLGTWINCID"
}
Response
{
"token": "eyJhbGciOiJ...",
"tokenExpires": "2022-10-04T12:26:41Z",
...
}
Example 1b: Authenticate using password
Get authenticated with username and password. The response will contain a token to be used for subsequent API calls.
Request
POST /api/authentication HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
{
"username": "example@provider.com",
"password": "b44463cb1f9f55990d1ea866f928334785a64e4732b866261ef2e50ee3797c55",
"appName":"Something that what is using the API (ie. MyApp)",
"appVersion":"1.0"
}
Response
{
"token": "eyJhbGciOiJ...",
"tokenExpires": "2022-10-04T12:26:41Z",
...
}
Example 2: Get assets
Retrieve a list of all of your assets.
Request
GET /api/asset HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
Response
[
{
"id": 12345,
"name": "ABC",
"code": "ABC",
"plateNumber": "ABC",
"vehicleType": 0,
"brand": "Mercedes",
"model": "A",
"color": "White",
"isCommentWarning": false,
"deviceId": 201460,
"unitId": "358480083060170",
"isActive": true,
"isArchived": false
}
]
Example 3: Get a single asset by ID
Retrieve a particular asset by ID.
Request
GET /api/asset/12345 HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
Response
[
{
"id": 12345,
"name": "ABC",
"code": "123",
"plateNumber": "AB-CD-EF",
"vehicleType": 0,
"brand": "Mercedes",
"model": "A",
"color": "White",
"isCommentWarning": false,
"deviceId": 201460,
"unitId": "358480083060170",
"isActive": true,
"isArchived": false
}
]
Example 4: Get a trips between certain date and time
Retrieve a list of trips for a particular asset by ID and start and end datetime. A trip starts when the ignition is turned on until the ignition is turned off.
Request
GET /api/trip?assetId=12345&start=0&end=1667762796 HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
Response
[
{
"id": 0,
"assetId": 12345,
"deviceId": 0,
"assetName": "string",
"beginTS": "2022-11-06T19:22:19.567Z",
"endTS": "2022-11-06T19:22:19.567Z",
"beginLatitude": 0,
"beginLongitude": 0,
"endLatitude": 0,
"endLongitude": 0,
"beginCity": "string",
"beginAddress": "string",
"beginAddressFull": "string",
"endCity": "string",
"endAddress": "string",
"endAddressFull": "string",
"comment": "string",
"segmentDistanceInKilometers": 0,
"jsonLocationData": "string",
"driver": "string",
"tripMethod": 0,
"tripType": 0,
"kmPrivate": 0,
"maxSpeed": 0,
"driverName": "string",
"driverId": 0,
"isPrivate": true,
"isHidden": true
}
]
Example 5: Get distance travelled summary between certain date and time
Retrieve a summary of distance travelled particular asset (or device) by ID and start and end datetime.
Request
GET /api/trip/messagesummary?deviceid=0&assetId=12345&start=0&end=1667762796 HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
Response
{
"deviceId": 0,
"assetId": 0,
"distanceInKm": 0,
"beginLatitude": 0,
"beginLongitude": 0,
"endLatitude": 0,
"endLongitude": 0,
"calibratedOdoValueBegin": 0,
"calibratedOdoValueEnd": 0,
"firstMessage": "2022-11-09T09:52:30.140Z",
"lastMessage": "2022-11-09T09:52:30.140Z"
}
Example 6: Update asset properties
Update existing assets. It’s required to include all properties, including existing.
Request
PUT /api/asset/12345
HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
{
"driverId": 4021997,
"assetId": 4022799,
"startDate": 1313120000,
"endDate": 1313130000
}
Response
{
"id": 12345,
"deviceId": 0,
"name": "string",
"assignmentStart": "2022-12-15T14:01:43.252Z",
"assignmentEnd": "2022-12-15T14:01:43.252Z",
"assetTypeId": 0,
"code": "string",
"plateNumber": "string",
"year": "string",
"vin": "string",
"brand": "string",
"model": "string",
...
}
Example 7: Assign driver to asset
Assign a driver to an asset for a period of time.
Request
PUT /api/asset/12345/assigndriver
HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
{
"driverId": 67890,
"assetId": 12345,
"startDate": 1675247937,
"endDate": 1675247937
}
Response
{
"isSuccess": true,
"message": "Assignment was successful!",
"id": 0,
"errorItems": {},
"errorCount": 0
}
Example 8: Request location updates of your fleet
Initially you will get the last location of all of your vehicles. Consecutively you will only get updates for vehicles that have updates.
Initial Request
POST /api/statelookup
HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
{
"deviceIds":[],
"previousLookupTimestamp": null
}
Consecutive Request
POST /api/statelookup
HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
{
"deviceIds":[],
"previousLookupTimestamp": "2023-07-01T09:23:49.0048798Z"
}
Response
{
"deviceStates": {
"123456": {
"id": 123456,
"currentPosition": {
"latitude": 16.9403716,
"longitude": 42.6322533,
"updateTimestamp": "2023-07-01T09:26:54.01",
"speed": 0.0,
"heading": 81.0,
"altitude": 24.0,
"hdop": 0.7,
"pdop": 1.1,
"satellites": 14
},
"odometer": {
"gpsOdometer": 203739332,
"canBusOdometer": 2354439100,
"updateTimestamp": "2023-07-01T09:27:00"
}
...
},
"timestamp": "2023-07-01T09:23:49.0048798Z"
}
Example 9: Request message history for a vehicle
Retrieves a list of all historical location messages between two timestamps.
Request
POST /api/message
HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
{
"deviceId":12345,
"start": 1675247937,
"end": 1675247937,
}
Response
[
{
"id": 0,
"latitude": 0,
"longitude": 0,
"locationType": 0,
"speedInKph": 0,
"satellites": 0,
"timestamp": "2023-09-15T15:11:28.991Z",
"ignition": true,
"externalPower": true,
"odoValue": 0,
"input1": true,
"input2": true,
"heading": 0,
"altitude": 0,
"rfid": "string",
"driverIdTag": "string",
"output1": true,
"output2": true,
"fuelLevel": 0,
"temperature": 0,
"temperature2": 0,
"canBusOdoInMeters": 0,
"rpm": 0,
...
}
]
Example 10: Search for vehicle
Retrieves a list of all vehicles that match the search pattern. It’s matched on assetname, platenumber and assetcode.
Request
GET /api/search/devices?search=abcdefg
HTTP/1.1
Host: https://fleetmanagement-api.staging.gpscockpit.net
Authorization: Bearer eyJhbGciOiJ...
Response
[
{
"id": 0,
"name": "string",
"searchResultType": 0
}
]
API documentation