Create Vehicle
POST /tms/vehicles
Description
This endpoint is used to create a new vehicle record in the system. The request must include details about the vehicle such as the driver’s user ID, license plate, and other relevant attributes.
Parameters
- tenantId (
string, header, required): The ID of the tenant. - countryCode (
string, header, required): The country code where the vehicle is registered.
Request Body
- Media Type:
application/json
Example Value
{
"driverUserId": "string",
"carrierPhoneNumber": "string",
"licensePlate": "string",
"model": "string",
"manufacturer": "string",
"capacity": "string",
"colour": "string",
"year": "string",
"type": "string",
"imageUrl": "string",
"carrierId": "string",
"condition": "string"
}
Responses
201 Created
The 201 Created response is returned when the vehicle is successfully created. This response includes details about the status of the operation.
Response Fields
| Field | Type | Description |
|---|---|---|
| status | boolean | Indicates the success of the vehicle creation. |
| statusCode | integer | Numeric code representing the status of the response (e.g., 0 for success). |
| message | string | A message indicating the outcome of the operation. |
| data | object | Contains details of the created vehicle. |
| errors | array | An array of objects providing details about any errors encountered during the request. |
Example Value
{
"status": true,
"statusCode": 0,
"message": "Vehicle created successfully",
"data": {},
"errors": []
}
400 Bad Request
The 400 Bad Request response is returned when the request is invalid. This response indicates that there were issues with the data provided in the request.
Example Value
{
"status": false,
"statusCode": 400,
"message": "Invalid request",
"data": {},
"errors": [
{
"message": "Invalid field value",
"descriptiveMessage": "The value provided for the 'licensePlate' field is incorrect."
}
]
}
LANGUAGE
CURL REQUEST
curl --request POST \
--url /tms/vehicles \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!