Senders can create orders containing one or more order items via the Yojee API
Use this endpoint to create a new order using a Sender account.
- POST /api/v3/sender/orders
- API reference link: https://api-docs.yojee.com/#sender-ordercontroller-create
Request Headers - key elements
Parameter |
Required? |
Type |
Description |
access_token |
Yes |
String |
Access token generated |
company_slug |
Yes |
String |
Dispatcher company slug |
Request Body - key elements
Parameter |
Required? |
Type |
Description |
items |
Yes |
Array |
List of items involved in the order |
steps |
Yes |
Array |
Also known as "order steps". An array of objects, each object refer to a unique step to be performed (location, time window and of type pickup/dropoff) |
Item_steps |
Yes |
Array |
List of item steps, referencing the "items" and "order steps" above |
placed_by_user_profile_id
|
Yes |
String |
User profile ID |
Sample Request Body
{
"external_id": "EXT-20210507",
"sender_type": "organisation",
"placed_by_user_profile_id": 28431,
"steps": [
{
"to_time": "2021-06-24T16:00:00+00:00",
"state": "Selangor",
"postal_code": "60000",
"from_time": "2021-06-24T08:00:00+00:00",
"country": "Malaysia",
"contact_phone": "+601111111111",
"contact_name": "Jason",
"contact_email": "jasonyeoh@yojee.com",
"contact_company": "Yojee Ltd",
"address": "Sungai Buloh Hospital",
"address2": ""
},
{
"to_time": "2021-06-24T16:00:00+00:00",
"state": "Selangor",
"postal_code": "56100",
"from_time": "2021-06-24T08:00:00+00:00",
"country": "Malaysia",
"contact_phone": "+601111111111",
"contact_name": "Lim",
"contact_email": "lim@yojee.com",
"contact_company": "Yojee Deliveries",
"address": "Leisure Mall Cheras",
"address2": ""
}
],
"items": [
{
"service_type": "same_day",
"width": "35",
"weight": "15",
"length": "25",
"height": "55",
"quantity": "1",
"price_info": "Surcharge RM12.00",
"price_amount": "55",
"price_currency": "MYR",
"cod_price_amount": "0",
"cod_price_currency": "MYR",
"payload_type": "Document",
"info": "Interesting Box. Open after payment, only!",
"external_customer_id3": "",
"external_customer_id2": "",
"external_customer_id": "EXT-9898",
"description": "Open to see."
}
],
"item_steps": [
{
"type": "pickup",
"order_step_id": 0,
"item_id": 0
},
{
"type": "dropoff",
"order_step_id": 1,
"item_id": 0
}
]
}
Sample Response Body
Server Code Status: 200 => Create order response success
Server Code Status: 422 => OrderMap { "message": “Order creation failed!” }
example value(s)
{
"data": {
"cancelled_at": null,
"container_no": null,
"display_price": "SGD 10",
"external_id": null,
"id": 6232,
"inserted_at": "2019-06-04T04:01:04.307128Z",
"number": "O-LOXUINQXEDGT",
"order_items": [
{
"id": 50016,
"tracking_number": "YOJ-VYOFVPA43FMB"
}
],
"placed_by_user_profile_id": 2359,
"price": {
"amount": "10",
"currency": "SGD"
},
"sender_id": 475,
"status": "created"
}
}