Job Management
Create Job
Create a new job with tasks in your Fleetwork account.
POST/api/v1/workspace/jobs
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
jobName | string | Required | Job name |
jobStatus | integer | Required | 0=New, 1=Scheduled, 2=InProgress |
jobType | integer | Required | 0=Unknown, 1=Shipment, 2=Service |
jobDescription | string | Optional | Job description |
metaData | string | Optional | Custom JSON metadata string |
tasks | array | Required | Array of task objects (see Task fields below) |
Shipment jobs (jobType=1) require exactly 2 tasks: one Pick
(shipmentType=1) and one Drop (shipmentType=2). The API returns an error if
this condition is not met.
Task Fields
| Field | Type | Required | Description |
|---|---|---|---|
taskName | string | Required | Task name |
taskType | integer | Optional | 0=Unknown, 1=Shipment, 2=Service |
priority | integer | Optional | 0=Low, 1=Medium, 2=High |
description | string | Optional | Task description |
contactName | string | Optional | Contact person name |
contactPhone | string | Optional | Contact phone number |
startDt | long | Optional | Scheduled start time (Unix ms) |
endDt | long | Optional | Scheduled end time (Unix ms) |
startTime | integer | Optional | Time window start (minutes from midnight) |
endTime | integer | Optional | Time window end (minutes from midnight) |
serviceTime | integer | Optional | Service duration in minutes |
setupTime | integer | Optional | Setup duration in minutes |
place | object | Optional | Place object - see Place fields below. Use the Search Places API to retrieve valid refIds. |
metaData | string | Optional | Task-level custom JSON metadata |
skillId | UUID | Optional | Required skill ID for this task |
shipmentProperty | object | Conditional | Required for Shipment jobs - see below |
place fields
| Field | Type | Required | Description |
|---|---|---|---|
id | UUID | Optional | ID of an existing place (if already in address book) |
refId | string | Required | Your external reference ID for this place (see Search Places) |
name | string | Optional | Place name |
address | string | Optional | Full address |
lat | number | Optional | Latitude |
lng | number | Optional | Longitude |
contactPerson | string | Optional | Contact person name |
contactNum | string | Optional | Contact phone number |
startTime | integer | Optional | Time window start (minutes from midnight) |
endTime | integer | Optional | Time window end (minutes from midnight) |
shipmentProperty fields (Shipment job only)
| Field | Type | Required | Description |
|---|---|---|---|
shipmentType | integer | Required | 1=Pick, 2=Drop |
{
"jobName": "Delivery Job Q1",
"jobDescription": "Morning delivery run",
"jobStatus": 1,
"jobType": 1,
"tasks": [
{
"taskName": "Pick up goods",
"taskType": 1,
"priority": 1,
"contactName": "Mr. Tuan",
"contactPhone": "+84901234567",
"shipmentProperty": { "shipmentType": 1 },
"place": {
"refId": "WH-001",
"name": "Main Warehouse",
"address": "100 Warehouse St, D7",
"lat": 10.74,
"lng": 106.72
}
},
{
"taskName": "Deliver to Customer A",
"taskType": 1,
"priority": 1,
"contactName": "Ms. Lan",
"contactPhone": "+84907654321",
"shipmentProperty": { "shipmentType": 2 },
"place": {
"refId": "CUST-A-001",
"name": "Customer A Location",
"address": "123 Le Loi, D1",
"lat": 10.7731,
"lng": 106.703
}
}
]
}Example
Request
curl -X POST \
"https://live.fleetwork.vn/api/v1/workspace/jobs" \
-H "API-KEY: <your-key>" \
-H "Content-Type: application/json" \
-d '{"jobName":"Delivery Job Q1","jobStatus":1,"jobType":1,"tasks":[{"taskName":"Pick up goods","taskType":1,"priority":1,"shipmentProperty":{"shipmentType":1},"place":{"refId":"WH-001","name":"Main Warehouse","address":"100 Warehouse St, D7","lat":10.74,"lng":106.72}},{"taskName":"Deliver to Customer A","taskType":1,"priority":1,"contactName":"Ms. Lan","contactPhone":"+84907654321","shipmentProperty":{"shipmentType":2},"place":{"refId":"CUST-A-001","name":"Customer A","address":"123 Le Loi, D1","lat":10.7731,"lng":106.703}}]}'Response
{
"code": "OK",
"message": null,
"data": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}The data field contains the UUID of the newly created job.