Add Transport Type
The addTransportType API endpoint is used to add a new customized transport type in the system. The endpoint handles duplication validation, ID generation and database persistence.
Endpoint
POST /rest/booking/addTransportType
Request Body
The request payload must provide the active username, its authorization token authKey, and the name of the new transport type transportTypeName.
{
"username": "admin_user",
"authKey": "a-valid-authorization-key",
"transportTypeName": "Refrigerated Van"
}
Response
The response is a JSON object confirming the status of the operation (success or failure) alongside a message details.
Success Response (200 OK):
{
"success": true,
"message": "Saved Successfully."
}
Duplicate Transportation Type Error (200 OK):
{
"success": false,
"message": "Already Exist."
}
Unauthorized (401 Unauthorized):
{
"success": false,
"message": "Unauthorized"
}
Internal Server Error (500 Internal Server Error):
{
"success": false,
"message": "Internal server error"
}
Business Logic Constraints
-
Authentication Rule: Validates the user's
authKeyto verify permissions. Without anauthKeythe request fails. It automatically decodes thetenantIdfrom the active context root. -
Format Rule Validation: Checks whether identical transport type configurations already exist in the database for the resolved
tenantId. Validation checks iftransportTypeNameequals any existing properties insidecheckDuplicateTransportType(transportTypeList, tenantId). -
Identifier System Constraints: Auto-generates the
transportTypeIdusing prefix allocations. It callsgeneratedTransportId(tenantId)that reads theprefixtablemappings configuration (e.g. prefix might beTRLyieldingTRL0025). -
Persistence Operation Execution: Once validated, the changes run exclusively through
addNewTransportTypeListwhich commits changes directly into the configured SQL table, returning a Boolean boolean execution acknowledgment boolean, after which it performs an internal application refreshTmsConstants.transportTypeList.put(tenantId, ...)cache flush to ensure consistent data views.