Request
POST https://backend.net0.com/v1/travels
This endpoint allows you to create a single trip for an employee.
curl --location --request POST 'https://backend.net0.com/v1/travels' \
--header 'x-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"movementDto": {
"fromAddress": {
"startAddress": "New providence Gardens",
"startPoint": "[6.457823703894839, 3.553948217590948]"
},
"toAddress": {
"endAddress": "Just Basics Bakery",
"endPoint": "[6.464483144521335, 3.6299068753288988]"
},
"weight": 20,
"name": "Opman Trip",
"referenceNumber": "3fr566f-3dsfhajs",
"isReturnMoving": true,
"startDate": "2021-11-28T15:29:56.471Z",
"endDate": "2021-11-28T16:29:56.471Z",
"transportType": "TRUCK",
"vendorId": "8df19e8c-5acf-4d3c-92af-6b1870a8a7ed",
"transportWeightTon": 40
},
"comment": "Example Travel",
"startDateUtc": "2022-11-28T16:29:56.471Z",
"endDateUtc": "2022-12-28T16:29:56.471Z",
"bookingReference": 0,
"hotelNights": 2,
"flightClass": "ECONOMY"
}'
Field Parameters
{
"movementDto": {
"fromAddress": {
"startAddress": "string",
"startPoint": "string"
},
"toAddress": {
"endAddress": "string",
"endPoint": "string"
},
"weight": 0,
"name": "string",
"referenceNumber": "string",
"customOptions": {},
"isReturnMoving": true,
"startDate": "2021-11-24T12:57:59.763Z",
"endDate": "2021-11-24T12:57:59.763Z",
"transportType": "TRUCK",
"vendorId": "string",
"transportWeightTon": 0,
"comment": "string"
},
"comment": "string",
"startDateUtc": "string",
"endDateUtc": "string",
"bookingReference": 0,
"hotelNights": 0,
"flightClass": "ECONOMY"
}
Attribute | Type | Description |
---|---|---|
movementDto | Object | This is a data transfer object that contains the fromAddress and toAddress object destinations of a particular trip and other parameters. |
weight | Number | Describes the weight in Kilograms in the movementDto. |
name | String | This is the name of the travel in the movementDto. |
referenceNumber | String | Describes the associated reference number in the movementDto. |
customOptions | Object | This describes customizable values of a travel in the movementDto. |
isReturnMoving | Boolean | Specifies if a travel would be return-enabled in the movementDto. |
startDate | String | This is the start date of the travel in the movementDto in the movementDto. |
endDate | String | This is the end date of the travel in the movementDto in the movementDto. |
transportType | String | Describes the mode of transportation in the movementDto. |
vendorId | String | This is the id of the vendor in the movementDto. |
transportWeightTon | Number | The weight of the transport mode in the movementDto. It has a maximum of 59. |
comment | String | A comment on the movementDto. |
startDateUtc | String | Describes the start date of the travel in UTC value. |
endDateUtc | String | Describes the end date of the travel in UTC value. |
bookingReference | String | This is a booking reference for the travel. |
hotelNights | Number | Describes the number of nights to be spent in an hotel. |
flightClass | String | Describes the class of the flight. Enum values are: [ ECONOMY, PREMIUM_ECONOMY, BUSINESS, FIRST_CLASS ]. |
Response
The response is a JSON response of the created travel.
{
"id": "string",
"emissionKind": {
"id": "string",
"scope": "SCOPE_1",
"underScope": "Sites",
"activityTypeUnderScope": "COMPANY_VEHICLE",
"name": "string",
"companyId": 0,
"siteElectricitys": [
{
"id": "string",
"totalEmission": 0,
"value": 0,
"percentageOfCleanEnergy": 0,
"comment": "string",
"startDate": "2021-11-24T12:57:59.819Z",
"endDate": "2021-11-24T12:57:59.819Z",
"createdAt": "2021-11-24T12:57:59.819Z",
"updatedAt": "2021-11-24T12:57:59.819Z",
"emission": {
"id": "string",
"co2": 0,
"ch4": 0,
"n2o": 0,
"co2e": 0,
"createdAt": "2021-11-24T12:57:59.819Z",
"updatedAt": "2021-11-24T12:57:59.819Z",
"unit": {
"id": 0,
"name": "string",
"short_name": "string",
"multiplier": 0,
"parent_id": 0,
"typeUnit": "WEIGHT",
"emissionFactorsDenominators": [
null
],
"emissionFactorsNumerators": [
null
],
"sitesElectricitys": [
null
],
"sitesFuels": [
null
],
"emissions": [
null
],
"vehiclesActivityUnits": [
null
],
"vehiclesFuelConsumptionUnit": [
null
],
"createdAt": "2021-11-24T12:57:59.819Z",
"updatedAt": "2021-11-24T12:57:59.819Z"
}
}
}
]