Sending trips
This chapter contains the API-specification on how to send trip messages to a device running the FleetGO Drivers App.
Sending trip messages using the FleetGO Barneveld Trip API is an asynchronous process. The trip API is used to send a trip message from an external source to the FleetGO backend. When calling the API, the trip message won't be sent to the device immediately. Instead, the trip message is saved on the FleetGO backend. A service on the FleetGO backend is responsible for actually sending the trip message to the device.
When a trip message has been received successfully by the Drivers App. An EntityReceived message or EntityDeleted message is generated. Most often these messages are generated just shortly after sending a trip message, but this isn't always the case. For example, when sending tomorrow's trip to a device which is already turned off the EntityReceived message will probably be generated the next day.
Trip API
The Trip API is used for sending trip messages to a device.
Sending a trip message is done by sending a POST request to:
The endpoint contains 2 required path parameters type and identifier. The values for these parameters are described in the table below.
Field | Required | Type | Description |
|---|---|---|---|
type | true | string | The type path parameter is used to determine which type of asset the trip message should be sent to. Possible values are:
|
identifier | true | string | This value is based on the value used in the
|
The request body consists of the fields described below.
Field | Required | Type | Description |
|---|---|---|---|
tripId | true | string | A unique identifier for the trip. It is recommended to use the same value used as the |
content | true | A trip message as described in the Trip messages chapter. | |
driverId | false | string | This field is required when sending trips to the combination of vehicle/driver. This field should contain the driver ID as configured in the FleetControl backoffice. |
The example below contains the structure of the request body. For brevity the data field of the trip message is left empty. Normally this field would contain the Entity representing the trip.
Authorization
Authorization is done using an API-key. The API-key is generated by FleetGO Barneveld. The API-key is added as a token header to the API request.
To obtain an API-key please contact support@d2t.nl and provide a list of IP-addresses that need to be whitelisted.
Examples
The examples below show different ways of sending a trip.
The example below contains details about the API-request to send a trip message to a device with app ID 150.
Method | POST |
|---|---|
Endpoint | https://d2tfunctms.azurewebsites.net/api/Trip/device/150 |
Headers |
|
Body | {
"tripId": "1234",
"sequenceNumber": "4",
"content": {
"action": "update",
"data": {
"foreignId": "1234",
"flag": "trip",
"title": "3",
"rank": 1,
"meta": {
"driver": "John Doe",
"date": "12-02-2020"
},
"entities": [
{
"foreignId": "LA-1234-1",
"flag": "stop",
"title": "Load action 1234-1",
"meta": {
"type": "load",
"date": "12-02-2020",
"tripReference": "1234",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LA-1234-1-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
},
{
"foreignId": "LO-1234-2",
"flag": "stop",
"title": "Unload action 1234-2",
"meta": {
"type": "unload",
"tripReference": "1234",
"date": "12-02-2020",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LO-1234-2-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
}
]
}
}
} |
The example below contains details about the API-request to send a trip message to a driver with ID 1.
Method | POST |
|---|---|
Endpoint | https://d2tfunctms.azurewebsites.net/api/Trip/driver/1 |
Headers |
|
Body | {
"tripId": "1234",
"sequenceNumber": "4",
"content": {
"action": "update",
"data": {
"foreignId": "1234",
"flag": "trip",
"title": "3",
"rank": 1,
"meta": {
"driver": "John Doe",
"date": "12-02-2020"
},
"entities": [
{
"foreignId": "LA-1234-1",
"flag": "stop",
"title": "Load action 1234-1",
"meta": {
"type": "load",
"date": "12-02-2020",
"tripReference": "1234",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LA-1234-1-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
},
{
"foreignId": "LO-1234-2",
"flag": "stop",
"title": "Unload action 1234-2",
"meta": {
"type": "unload",
"tripReference": "1234",
"date": "12-02-2020",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LO-1234-2-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
}
]
}
}
} |
The example below contains details about the API-request to send a trip message to a vehicle with license plate TE-ST-12.
Method | POST |
|---|---|
Endpoint | https://d2tfunctms.azurewebsites.net/api/Trip/vehicle/TE-ST-12 |
Headers |
|
Body | {
"tripId": "1234",
"sequenceNumber": "4",
"content": {
"action": "update",
"data": {
"foreignId": "1234",
"flag": "trip",
"title": "3",
"rank": 1,
"meta": {
"driver": "John Doe",
"date": "12-02-2020"
},
"entities": [
{
"foreignId": "LA-1234-1",
"flag": "stop",
"title": "Load action 1234-1",
"meta": {
"type": "load",
"date": "12-02-2020",
"tripReference": "1234",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LA-1234-1-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
},
{
"foreignId": "LO-1234-2",
"flag": "stop",
"title": "Unload action 1234-2",
"meta": {
"type": "unload",
"tripReference": "1234",
"date": "12-02-2020",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LO-1234-2-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
}
]
}
}
} |
The example below contains details about the API-request to send a trip message to the combination of a vehicle with license plateTE-ST-12 and driver with ID 1. When speaking about a combination it means that both the vehicle and driver should match for the trip to be visible. When either doesn't match, the trip isn't visible in the app.
This method differs slightly from the "To vehicle" method. The license plate of the vehicle should still be included as a path parameter, but driver needs to be specified using the driverId field in the payload.
Method | POST |
|---|---|
Endpoint | https://d2tfunctms.azurewebsites.net/api/Trip/vehicle/TE-ST-12 |
Headers |
|
Body | The request body contains an additional {
"tripId": "1234",
"sequenceNumber": "4",
"driverId": "1",
"content": {
"action": "update",
"data": {
"foreignId": "1234",
"flag": "trip",
"title": "3",
"rank": 1,
"meta": {
"driver": "John Doe",
"date": "12-02-2020"
},
"entities": [
{
"foreignId": "LA-1234-1",
"flag": "stop",
"title": "Load action 1234-1",
"meta": {
"type": "load",
"date": "12-02-2020",
"tripReference": "1234",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LA-1234-1-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
},
{
"foreignId": "LO-1234-2",
"flag": "stop",
"title": "Unload action 1234-2",
"meta": {
"type": "unload",
"tripReference": "1234",
"date": "12-02-2020",
"address": {
"name": "FleetGO Barneveld",
"address": "Anthonie Fokkerstraat 43A",
"zipCode": "3772 MP",
"city": "Barneveld",
"countryCode": "NL",
"latitude": 52.12818,
"longitude": 5.5658
}
},
"entities": [
{
"foreignId": "LO-1234-2-9876",
"flag": "goods_line",
"meta": {
"name": "Europallet with smartphones",
"unit": "pallet",
"weight": 1000.0,
"amount": 2,
"ldm": 4
},
"title": "Smartphones",
"entities": []
}
]
}
]
}
}
} |