Create trip

post

/fleetMonitoring/clientapi/v2/trips

This operation creates a new trip. To create a default trip, provide {vehicle.name and tripTemplateId} as request parameters. To create a custom trip, provide {vehicle.name, source, destination, and stops} as request parameters.

Permissions

To create a trip the request must have driver role credentials.

Request

Supported Media Types
Body ()
Root Schema : TripImpl_create
Type: object
Show Source
Nested Schema : TripStopRecord_create
Type: object
Show Source
Nested Schema : stops
Type: array
List of stops for the trip
Show Source
Nested Schema : tripContext
Type: array
List of Trip Context for the trip
Show Source
Nested Schema : TripVehicleInfoModel_create
Type: object
Show Source
Nested Schema : GeoPosition_create
Type: object
Show Source
Nested Schema : additionalElements
Type: array
Property description was not set
Show Source
Nested Schema : TripModel$TripContext_create
Type: object
Show Source

Response

Supported Media Types

202 Response

Successfully processed.
Body ()
Root Schema : TripImpl_receive
Type: object
Show Source
Nested Schema : TripStopRecord_receive
Type: object
Show Source
Nested Schema : GeoPosition_receive
Type: object
Show Source
Nested Schema : stops
Type: array
List of stops for the trip
Show Source
Nested Schema : tripContext
Type: array
List of Trip Context for the trip
Show Source
Nested Schema : TripVehicleInfoModel_receive
Type: object
Show Source
Nested Schema : additionalElements
Type: array
Property description was not set
Show Source
Nested Schema : TripModel$TripContext_receive
Type: object
Show Source

400 Response

Bad Request. The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

401 Response

Unauthorized. The request requires user authentication.

403 Response

Forbidden. The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated.

406 Response

Not Acceptable. The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.

415 Response

Unsupported Media Type. The request entity has a media type which the server or resource does not support.

Examples

curl -X POST 
   -u <username>:<password>
   -H 'Accept: application/json'
   -H 'Content-Type: application/json'
   https://iotserver/fleetMonitoring/clientapi/v2/trips

Example of Request Body

The following example shows the content of the request body in JSON format:


{
"tripTemplateId":"35832d013b8a-e42",
"name":"Trip name",
"destination":{
"distanceToNextStop":0.0,
"country":"Name of country",
"stopSequence":12345,
"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.",
"city":"Name of City",
"geoLocation":[longitude,latitude],
"street":"Name of Street",
"postalCode":"Postal/Zip code",
"expectedDurationFromStart":12345,
"timeZone":"Time zone of the time fields",
"state":"Name of State"
},
"source":{
"distanceToNextStop":0.0,
"country":"Name of country",
"stopSequence":12345,
"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.",
"city":"Name of City",
"geoLocation":[longitude,latitude],
"street":"Name of Street",
"postalCode":"Postal/Zip code",
"expectedDurationFromStart":12345,
"timeZone":"Time zone of the time fields",
"state":"Name of State"
},
"stops":[
{
"distanceToNextStop":0.0,
"country":"Name of country",
"stopSequence":12345,
"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.",
"city":"Name of City",
"geoLocation":[longitude,latitude],
"street":"Name of Street",
"postalCode":"Postal/Zip code",
"expectedDurationFromStart":12345,
"timeZone":"Time zone of the time fields",
"state":"Name of State"
}
],
"vehicle":{
"registrationNumber":"vehicle registration number",
"name":"vehicle name",
"id":"4216181855b5-93e"
}
}

Example of Response Body

The following example shows the content of the response body in JSON format:


{
"lastModifiedTime":1469184297746,
"tripTrackingStatus":"One of [ON_TIME, DELAYED].",
"totalStops":12345,
"destination":{
"departureTime":1469184297746,
"stopDurationInSeconds":12345,
"distanceToNextStop":0.0,
"country":"Name of country",
"stopSequence":12345,
"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.",
"city":"Name of City",
"plannedArrivalTime":1469184297746,
"postalCode":"Postal/Zip code",
"expectedDurationFromStart":12345,
"timeZone":"Time zone of the time fields",
"plannedDepartureTime":1469184297746,
"stopType":"The reason for stopping",
"estimatedTimeToNextStop":1469184297746,
"estimatedDepartureTime":1469184297746,
"geoLocation":[longitude,latitude],
"arrivalTime":1469184297746,
"street":"Name of Street",
"state":"Name of State",
"estimatedArrivalTime":1469184297746
},
"stopsClassification":"One of [SINGLE_STOP, DUAL_STOP, TRIPLE_STOP, MULTI_STOP, NON_STOP].",
"source":{
"departureTime":1469184297746,
"stopDurationInSeconds":12345,
"distanceToNextStop":0.0,
"country":"Name of country",
"stopSequence":12345,
"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.",
"city":"Name of City",
"plannedArrivalTime":1469184297746,
"postalCode":"Postal/Zip code",
"expectedDurationFromStart":12345,
"timeZone":"Time zone of the time fields",
"plannedDepartureTime":1469184297746,
"stopType":"The reason for stopping",
"estimatedTimeToNextStop":1469184297746,
"estimatedDepartureTime":1469184297746,
"geoLocation":[longitude,latitude],
"arrivalTime":1469184297746,
"street":"Name of Street",
"state":"Name of State",
"estimatedArrivalTime":1469184297746
},
"unauthorizedStopsCount":12345,
"idlingDurationViolationCount":12345,
"vehicle":{
"registrationNumber":"vehicle registration number",
"name":"vehicle name",
"id":"12a31dfa564f-4098"
},
"totalStopDuration":12345,
"tripContext":[
{
"name":"Trip Context name",
"externalId":"727b71737fd-663c",
"type":"Trip Context type either Shipment or default trip",
"value":"Trip Context Id, either Trip or Shipment Id"
}
],
"speedViolationCount":12345,
"eta":12345,
"fuelConsumed":0.0,
"tripLengthClassification":"One of [SHORT, MEDIUM, LONG].",
"startTime":1469184297746,
"id":"2e2338f47a3-64eb",
"vehicleId":"293f1b987e81-6d8e",
"consumedFuelCost":0.0,
"distanceTraveled":0.0,
"tripLength":0.0,
"incidentCount":12345,
"expectedDuration":12345,
"estimatedDelay":12345,
"fenceViolationCount":12345,
"tripTemplateId":"2e0ef43557c-7ebb",
"driverId":"254a2f45586c-690b",
"geoLocation":[longitude,latitude],
"alertCount":12345,
"percentageComplete":0.0,
"name":"Trip name",
"stops":[
{
"departureTime":1469184297746,
"stopDurationInSeconds":12345,
"distanceToNextStop":0.0,
"country":"Name of country",
"stopSequence":12345,
"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.",
"city":"Name of City",
"plannedArrivalTime":1469184297746,
"postalCode":"Postal/Zip code",
"expectedDurationFromStart":12345,
"timeZone":"Time zone of the time fields",
"plannedDepartureTime":1469184297746,
"stopType":"The reason for stopping",
"estimatedTimeToNextStop":1469184297746,
"estimatedDepartureTime":1469184297746,
"geoLocation":[longitude,latitude],
"arrivalTime":1469184297746,
"street":"Name of Street",
"state":"Name of State",
"estimatedArrivalTime":1469184297746
}
],
"endTime":1469184297746,
"tripStatus":"One of [IN_PROGRESS, COMPLETED, CANCELLED].",
"elapsedDuration":12345
}



Complete cURL Example

The following example shows the complete cURL command that can be used to perform the described operation:

curl -X POST 
   -u <username>:<password>
   -H 'Accept: application/json'
   -H 'Content-Type: application/json'
   -d '{"tripTemplateId":"35832d013b8a-e42","name":"Trip name","destination":{"distanceToNextStop":0.0,"country":"Name of country","stopSequence":12345,"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.","city":"Name of City","geoLocation":{"valid":false,"altitude":0.0,"latitude":0.0,"longitude":0.0,"additionalElements":["additionalElements_1","additionalElements_2","additionalElements_3"]},"street":"Name of Street","postalCode":"Postal/Zip code","expectedDurationFromStart":12345,"timeZone":"Time zone of the time fields","state":"Name of State"},"source":{"distanceToNextStop":0.0,"country":"Name of country","stopSequence":12345,"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.","city":"Name of City","geoLocation":{"valid":false,"altitude":0.0,"latitude":0.0,"longitude":0.0,"additionalElements":["additionalElements_1","additionalElements_2","additionalElements_3"]},"street":"Name of Street","postalCode":"Postal/Zip code","expectedDurationFromStart":12345,"timeZone":"Time zone of the time fields","state":"Name of State"},"stops":[{"distanceToNextStop":0.0,"country":"Name of country","stopSequence":12345,"address":"Unified full address, e.g. 110 Scottsville Center::Scottsville::VA::US::24590 . Must be provided if geoLocation is not specified.","city":"Name of City","geoLocation":{"valid":false,"altitude":0.0,"latitude":0.0,"longitude":0.0,"additionalElements":["additionalElements_1","additionalElements_2","additionalElements_3"]},"street":"Name of Street","postalCode":"Postal/Zip code","expectedDurationFromStart":12345,"timeZone":"Time zone of the time fields","state":"Name of State"}],"vehicle":{"registrationNumber":"vehicle registration number","name":"vehicle name","id":"4216181855b5-93e"}}'
   https://iotserver/fleetMonitoring/clientapi/v2/trips



Note that in the request, https://iotserver will be replaced by the name and port of your assigned IoT Cloud Service instance. The format of the Cloud Service instance is https://myinstance-myidentitydomain.iot.us.oraclecloud.com and the default port is 443.