Use this endpoint to create a new driver in the dispatch system, the response returns driver profile with a system-generated worker_id and user_profile_id.
- POST /api/v3/dispatcher/workers
- API reference link: https://api-docs.yojee.com/#Yojee-APIs-%5BDispatcher%5D-Worker
Request Parameters
Parameter |
Required? |
Type |
Description |
access_token |
Yes |
String |
Access token generated |
company_slug |
Yes |
String |
Dispatcher company slug |
vehicle_type_ids |
Yes |
Object |
List of worker's vehicle type ids |
phone |
Yes |
String |
Driver contact phone |
password |
Yes |
String |
Password |
name |
Yes |
String |
Driver’s name |
|
Yes |
String |
Driver’s email address |
current_vehicle_type_id |
Yes |
Integer |
Default Vehicle type id |
Request Sample cURL/Payload
curl -X POST "https://umbrella-dev.yojee.com/api/v3/dispatcher/workers" -H "accept: application/json" -H "ACCESS_TOKEN: pCVPeEEUuKnM7geUOcSLY2imA5l6YUdjymkApBDAAGY=" -H "COMPANY_SLUG: yojee" -H "content-type: application/json" -d "{ \"vehicle_type_ids\": [ 62 ], \"phone\": \"+987654387\", \"password\": \"passwd112233\", \"otp_token\": \"1122334455\", \"national_id\": \"11335577\", \"name\": \"Yojee Test Driver\", \"location\": { \"lng\": 122.6428429677108, \"lat\": 65.67691234535297 }, \"email\": \"yojee-driver@yojee.com\", \"driver_license\": \"22446688\", \"current_vehicle_type_id\": 62}"
Sample Response Body
Server Code Status: 200 => Created Worker Successfully
example value(s)
{
"data": {
"approved_at": "2019-06-19T03:22:56.719615Z",
"avatar": null,
"contract": "employee",
"current_vehicle_type_id": 62,
"deleted_at": null,
"distance_away": null,
"driver_license": "22446688",
"driver_license_photo_back": null,
"driver_license_photo_front": null,
"email": "yojee-driver@yojee.com",
"extension": {},
"id": 664,
"inserted_at": "2019-06-19T03:22:56.698093Z",
"last_seen": null,
"location": null,
"name": "Yojee Test Driver",
"national_id": "11335577",
"national_id_photo_back": null,
"national_id_photo_front": null,
"ongoing_tasks_count": 0,
"otp_token": null,
"phone": "+987654387",
"regions": [],
"static_otp_token": null,
"status": "off_duty",
"tester": null,
"user_profile_id": 2159,
"vehicle": null,
"vehicle_type_registers": [
{
"name": "Anu's Van",
"vehicle_type_id": 62
}
],
"worker_sequence": {
"polyline": null
}
},
"message": "Worker account created."
}
If you later need to update the information for one worker, please refer to the following PUT request to update driver particulars.
- PUT /api/v3/dispatcher/workers/{id}
- API reference link: https://api-docs.yojee.com/#dispatcher-workercontroller-update
Request Parameters
Parameter |
Required? |
Type |
Description |
access_token |
Yes |
String |
Access token generated |
company_slug |
Yes |
String |
Dispatcher company slug |
id |
Yes |
String |
Worker id |
worker |
Yes |
Body |
Worker details to be updated |
Request Sample cURL/Payload
curl -X PUT "https://umbrella-dev.yojee.com/api/v3/dispatcher/workers/664" -H "accept: application/json" -H "ACCESS_TOKEN: pCVPeEEUuKnM7geUOcSLY2imA5l6YUdjymkApBDAAGY=" -H "COMPANY_SLUG: yojee" -H "content-type: application/json" -d "{ \"phone\": \"+98765499987\"}"
Sample Response Body
Server Code Status: 200 => Sender update success
example value(s)
{
"data": {
"approved_at": "2019-06-19T03:22:56.719615Z",
"avatar": null,
"contract": "employee",
"current_vehicle_type_id": 62,
"deleted_at": null,
"distance_away": null,
"driver_license": "22446688",
"driver_license_photo_back": null,
"driver_license_photo_front": null,
"email": "yojee-driver@yojee.com",
"id": 664,
"inserted_at": "2019-06-19T03:22:56.698093Z",
"last_seen": null,
"location": null,
"name": "Yojee Test Driver",
"national_id": "11335577",
"national_id_photo_back": null,
"national_id_photo_front": null,
"ongoing_tasks_count": 0,
"otp_token": null,
"phone": "+98765499987",
"regions": [],
"static_otp_token": null,
"status": "off_duty",
"tester": false,
"user_profile_id": 2159,
"vehicle": null,
"vehicle_type_registers": [
{
"name": "Anu's Van",
"vehicle_type_id": 62
}
],
"worker_sequence": {
"polyline": null
}
},
"message": "Worker account updated."
}