Create Warehouse order
Create a new Warehouse order by user
- cURL
- JavaScript
curl --request POST \
--url https://apistg.ahamove.com/v1/order/create \
--header 'Cache-Control: no-cache' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'service_id=SGN-WAREHOUSE' \
--data-urlencode 'payment_method=BALANCE' \
--data-urlencode 'remarks=This is note for order' \
--data-urlencode 'order_time=0' \
--data-urlencode 'path=[{"lat":10.7692105,"lng":106.6637935,"address":"725 Hẻm số 7 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh, Việt Nam","short_address":"Quận 10","name":"nmbmb","mobile":"84xxxxxxxxx"},{"lat":10.7828887,"lng":106.704898,"address":"Miss Ao Dai Building, 21 Nguyễn Trung Ngạn, Bến Nghé, Quận 1, Hồ Chí Minh, Vietnam","name":"Bao","mobile":"84xxxxxxxxx","remarks":"call me","cod":520000,"item_value":830000,"weight":28,"height":42,"width":30,"length":64,"tracking_number":"ABCXXXXXXXX"}]' \
--data-urlencode 'items=[{"_id": "DG","num": 2,"name": "Combo dầu gội và sữa tắm Dove","price": 520000},{"_id": "ST","num": 1,"name": "Thùng sữa tươi Vinamilk","price": 310000}]' \
--data-urlencode 'token=<TOKEN_STG>'
var myHeaders = new Headers();
myHeaders.append('accept', 'application/json');
myHeaders.append('content-type', 'application/x-www-form-urlencoded');
var urlencoded = new URLSearchParams();
urlencoded.append('service_id', 'SGN-WAREHOUSE');
urlencoded.append('payment_method', 'BALANCE');
urlencoded.append('remarks', 'This is note for order');
urlencoded.append('order_time', '0');
urlencoded.append(
'path',
'[{"lat":10.7692105,"lng":106.6637935,"address":"725 Hẻm số 7 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh, Việt Nam","short_address":"Quận 10","name":"nmbmb","mobile":"84xxxxxxxxx"},{"lat":10.7828887,"lng":106.704898,"address":"Miss Ao Dai Building, 21 Nguyễn Trung Ngạn, Bến Nghé, Quận 1, Hồ Chí Minh, Vietnam","name":"Bao","mobile":"84xxxxxxxxx","remarks":"call me","cod":520000,"item_value":830000,"weight":28,"height":42,"width":30,"length":64,"tracking_number":"ABCXXXXXXXX"}]'
);
urlencoded.append("items", "[{"_id": "DG","num": 2,"name": "Combo dầu gội và sữa tắm Dove","price": 520000},{"_id": "ST","num": 1,"name": "Thùng sữa tươi Vinamilk","price": 310000}]");
urlencoded.append('token', '<TOKEN_STG>');
urlencoded.append('conversion_data', '');
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow',
};
fetch('https://apistg.ahamove.com/v1/order/create', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));
HTTP Request
POST https://apistg.ahamove.com/v1/order/create
(x-wwww-form-urlencoded)
or
GET https://apistg.ahamove.com/v1/order/create
Parameters
# Parameters
{
"order_time": 0,
"path": [
{
"lat": 10.7692105,
"lng": 106.6637935,
"address": "725 Hẻm số 7 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh, Việt Nam",
"short_address": "Quận 10",
"name": "nmbmb",
"mobile":"84xxxxxxxxx"
},
{
"lat": 10.7828887,
"lng": 106.704898,
"address": "Miss Ao Dai Building, 21 Nguyễn Trung Ngạn, Bến Nghé, Quận 1, Hồ Chí Minh, Vietnam",
"name": "Bao",
"mobile":"84xxxxxxxxx",
"remarks": "call me",
"cod": 520000,
"tracking_number": "ABCXXXXXXXX",
"weight": 28,
"height": 42,
"width": 30,
"length": 64,
"item_value": 830000
}
],
"service_id": "SGN-WAREHOUSE",
"remarks": "This is note for order",
"payment_method": "BALANCE",
"items": [
{
"_id": "DG",
"num": 2,
"name": "Combo dầu gội và sữa tắm Dove",
"price": 520000
},
{
"_id": "ST",
"num": 1,
"name": "Thùng sữa tươi Vinamilk",
"price": 310000
}
]
}
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | The user Token. Get token from API Register Account |
| order_time | Number (Unix timestamp) | Yes | The pickup time (order_time = 0) |
| path | String | Yes | At least 2 pairs (described in more detail below) |
| service_id | String | Yes | Warehouse Service ID, available in 2 cities are Ho Chi Minh City (SGN-WAREHOUSE) and Ha Noi (HAN-WAREHOUSE) |
| payment_method | String | Yes | Payment method for Warehouse service is BALANCE |
| remarks | String | No | Remarks |
| items | Array | No | List items |
Path
Representing from path[0] to path[1]
| Parameter | Type | Required | Description |
|---|---|---|---|
| address | String | Yes | Address of the location |
| lat | Number | Yes | Latitude of the location (Optional but highly recommended) |
| lng | Number | Yes | Longitude of the location (Optional but highly recommended) |
| name | String | Yes | Sender or Recipient's name |
| mobile | String | Yes | Sender or Recipient's mobile phone number |
| tracking_number | String | Yes | Partner's internal order code, at least 6 characters, no special characters (_, -, ., /, etc.) and must be unique. This code needs to be printed on the package |
| weight | Float | Yes | Actual weight of the package (Kg) |
| height | Float | Yes | Actual height of the package (cm) |
| length | Float | Yes | Actual length of the package (cm) |
| width | Float | Yes | Actual width of the package (cm) |
| item_value | Number | Yes | Actual value of the package |
| cod | Number | No | Amount of COD (Cash on Delivery) to be collected |
| remarks | String | No | Notes for the driver |
Note
lat and lng is not required but
address
field in parameters needs to have correct information as shown in the
format below
Ex: 117 Hùng Vương, Phường 4, Quận 5, Thành phố Hồ Chí Minh, Việt Nam
or 117 Hùng Vương, Phường 4, Quận 5, Hồ Chí Minh
Address Requirements for Sending to Ahamove
- Clear address with information segments separated by commas
- Address must be searchable on Google Maps (Google Plus Codes can be used)
- No redundant information in Ward/District/Province sections (for Partners allowing customers to select addresses from a dropdown)
Some types of Invalid Address :
- 658 võ văn kiệt p1 Quận 5 Hồ Chí Minh
- 58 Nghĩa Thục - Phường 5 - Quận 5 - Hồ Chí Minh - Việt Nam
- 22 Bùi Hữu Nghĩa
- 60/62 chiêu anh các
- 930 vo văn Kiệt p5q5
- Có ji e gởi đia chỉ 835/17c trần hung dao p1 q5 tphcm giúp c nha, Phường 01, Quận 5, Thành phố Hồ Chí Minh
- 54 Bạch Vân (Nhà màu xanh cuối hẻm, gọi số 0908999999), Phường 5, Quận 5, TP Hồ Chí Minh
- 189 Trần Tuấn Khải F.5 Q.5 Ngay ngã 3 Trần Hưng Đạo
- địa chỉ: 53 Huỳnh Mẫn Đạt phường 5 Quận 5 TP.HCM ĐT: 0912123456
- 14/20 .an binh p5q5
- 155 Trần Tuần Khải, p5, q5
- Số 1 bạch Vân phường 5 quận 5 TPHCM
- đc hẻm 93/107/16 đường bạch vân p5 q5
- 112 An Bình P5, Quận 5, HCM
- 1025, Phường 5, Quận 5
Items
| Field Information | Type | Required | Description |
|---|---|---|---|
| _id | String | Yes | Item ID |
| name | String | Yes | Item name |
| price | Int | Yes | Total item value after being multiplied by the quantity |
| num | Int | Yes | Quantity of the item |
Response
JSON response example:
{
"_id": "PARTNER_ABCXXXXXXXX", # ID of warehouse order, generated from partner name and partner’s tracking_number (upper case)
"tracking_number": "ABCXXXXXXXX",
"status": "VERIFYING" # For every successfully created orders, this value is VERIFYING
}
Status-Code: 200 OK
Errors
| Code | Text | Description |
|---|---|---|
404 | Not Found | - Token not found (Token has expired. When a new token is created, the old token has expired) - Path not found - Service not found |
406 | Not Acceptable | - Booking time not valid - Address not valid - Duplicate tracking_number - Distance not valid - Invalid pickup area - Invalid delivery area - Concurrent order not allowed (If partner not in token) - Large COD not allowed for first time user - Post paid not set for partner - Not supported payment method - Not enough credit - User’s phone number associated with - Token has been used for a partner - Child order status not valid (When creating parent order) - Parent order existed for #ABCXYZ (When creating a parent order but child orders already had a parent) - Idle until not valid (When client sent idle_until < current_time) - COD is not valid ( When total COD exceeds the maximum value which was configured in service) - Number of stop points are not valid |
408 | Request timeout | Google Distance API does not return results in 10 seconds. |
500 | Internal Server Error | We had a problem with our server. Try again later. |
503 | Service Unavailable | We're temporarily offline for maintenance. Please try again later. |