Making Order
The authenticated user can make single order at EasyParcel. User need to make sure the courier service is available.
POST
https://demo.connect.easyparcel.my/?ac=MPSubmitOrderBulk Body: application/x-www-form-urlencoded · action MPSubmitOrderBulk
Request parameters
Request L1
| Parameter | Type | Required | Description |
|---|---|---|---|
authentication | string(25) | Yes | Obtain from EasyParcel IT administrator |
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to Request L2) |
idempotency_ | string(255) | No | refer to https://easyparcel.github.io/nextgen-integration-doc/NextGenSwitches/idempotency_key |
Request L2 · bulk[]
| Parameter | Type | Required | Description |
|---|---|---|---|
weight | double(8,2) | Yes | The weight of the parcel. |
width | double(8,2) | Optional | The width of the parcel. |
length | double(8,2) | Optional | The length of the parcel. |
height | double(8,2) | Optional | The height of the parcel. |
content | string(35) | Yes | The content of the parcel. |
value | double(8,2) | Yes | The amount of the items. |
service_ | string(10) | Yes | Obtain from MPRateCheckingBulk return value. |
pick_ | string(35) | Yes / Optional | Obtain from MPRateCheckingBulk return value (point_id) from Dropoff_Point. |
pick_ | string(35) | Yes | Sender's name. |
pick_ | string(30) | Optional | Sender's company. |
pick_ | string(16) | Yes | Sender's contact. |
pick_ | string(16) | Optional | Sender's mobile. |
pick_ | string(35) | Yes | Sender's address line 1. |
pick_ | string(35) | Optional | Sender's address line 2. |
pick_ | string(35) | Optional | Sender's address line 3. |
pick_ | string(35) | Optional | Sender's address line 4. |
pick_ | string(35) | Yes | Sender's city. |
pick_ | string(35) | Yes | Sender’s state. |
pick_ | string(10) | Yes | Sender's postcode. |
pick_ | string(35) | Yes | Sender's country. (Refer to Appendix II) |
send_ | string(35) | Yes | Receiver's name. |
send_ | string(30) | Optional | Receiver's company. |
send_ | string(16) | Yes | Receiver's contact. |
send_ | string(16) | Optional | Receiver's mobile. |
send_ | string(35) | Yes | Receiver's address line 1. |
send_ | string(35) | Optional | Receiver's address line 2. |
send_ | string(35) | Optional | Receiver's address line 3. |
send_ | string(35) | Optional | Receiver's address line 4. |
send_ | string(35) | Yes | Receiver's city. |
send_ | string(35) | Yes | Receiver’s state. |
send_ | string(10) | Yes | Receiver's postcode. |
send_ | string(35) | Yes | Receiver's country. (Refer to Appendix II) |
collect_ | date | Yes | Check the available pickup date. If didn't put the date,today date will be default. Format : “YYYY-MM-DD” |
sms | boolean | Yes | Require for sms feature (Example, true/false) |
send_ | string(35) | Yes | Receiver’s email. |
hs_ | string(20) | Optional | Hs code is a common standard worldwide for describing the type of commodity that is shipped |
reference | string(25) | Optional | The parcel reference |
tax_ | string(10) | Optional | DDU or DDP |
parcel_ | string(10) | Optional | The parcel category id (Refer to Get Parcel Category) |
eori_ | boolean | Optional | For EasyParcel Business accounts, shipments to Europe require a valid EORI number to be configured in the Business Profile. Set this to true to acknowledge the risk and proceed with order submission without an EORI number provided |
Sample code
php
<?php
$domain = "https://demo.connect.easyparcel.my/?ac=";
$action = "MPSubmitOrderBulk";
$postparam = array(
'authentication' => 'xxxxxx',
'api' => 'xxxxxx',
'bulk' => array(
array(
'weight' => '1',
'width' => '0',
'length' => '0',
'height' => '0',
'content' => '2017-09-14 - book',
'value' => '20',
'service_id' => 'EP-CS0W',
'pick_point' => '',
'pick_name' => 'Yong Tat',
'pick_company' => 'Yong Tat Sdn Bhd',
'pick_contact' => '+6012-1234-5678',
'pick_mobile' => '+6017-1234-5678',
'pick_addr1' => 'ppppp46/7 adfa',
'pick_addr2' => 'test',
'pick_addr3' => 'test',
'pick_addr4' => '',
'pick_city' => 'NT',
'pick_state' => 'NT',
'pick_code' => '14300',
'pick_country' => 'MY',
'send_name' => 'Sam',
'send_company' => '',
'send_contact' => '+6012-2134567',
'send_mobile' => '+6017-1234-5678',
'send_addr1' => 'ssssadsasdst test',
'send_addr2' => 'test test',
'send_addr3' => 'test',
'send_addr4' => '',
'send_city' => 'NT',
'send_state' => 'NT',
'send_code' => '11950',
'send_country' => 'MY',
'collect_date' => '2017-11-22',
'sms' => '1',
'send_email' => '[email protected]',
'hs_code' => 'yshs_code',
'reference' => 'order12321'
),
array(
'weight' => '1',
'width' => '0',
'length' => '0',
'height' => '0',
'content' => '2017-09-14 - book',
'value' => '20',
'service_id' => 'EP-CS0W',
'pick_point' => '',
'pick_name' => 'Yong Tat',
'pick_company' => 'Yong Tat Sdn Bhd',
'pick_contact' => '+6012-1234-5678',
'pick_mobile' => '+6017-1234-5678',
'pick_addr1' => 'ppppp46/7 adfa',
'pick_addr2' => 'test',
'pick_addr3' => 'test',
'pick_addr4' => '',
'pick_city' => 'NT',
'pick_state' => 'NT',
'pick_code' => '14300',
'pick_country' => 'MY',
'send_name' => 'Sam',
'send_company' => '',
'send_contact' => '+6012-2134567',
'send_mobile' => '+6017-1234-5678',
'send_addr1' => 'ssssadsasdst test',
'send_addr2' => 'test test',
'send_addr3' => 'test',
'send_addr4' => '',
'send_city' => 'NT',
'send_state' => 'NT',
'send_code' => '11950',
'send_country' => 'MY',
'collect_date' => '2017-11-22',
'sms' => '1',
'send_email' => '[email protected]',
'hs_code' => 'yshs_code',
'reference' => 'order12321'
),
),
);
$url = $domain.$action;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postparam));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
ob_start();
$return = curl_exec($ch);
ob_end_clean();
curl_close($ch);
$json = json_decode($return);
echo "<pre>"; print_r($json); echo "</pre>";
?>bash
curl -X POST 'https://demo.connect.easyparcel.my/?ac=MPSubmitOrderBulk' \
--data-urlencode 'authentication=xxxxxx' \
--data-urlencode 'api=xxxxxx' \
--data-urlencode 'bulk[0][weight]=1' \
--data-urlencode 'bulk[0][width]=0' \
--data-urlencode 'bulk[0][length]=0' \
--data-urlencode 'bulk[0][height]=0' \
--data-urlencode 'bulk[0][content]=2017-09-14 - book' \
--data-urlencode 'bulk[0][value]=20' \
--data-urlencode 'bulk[0][service_id]=EP-CS0W' \
--data-urlencode 'bulk[0][pick_point]=' \
--data-urlencode 'bulk[0][pick_name]=Yong Tat' \
--data-urlencode 'bulk[0][pick_company]=Yong Tat Sdn Bhd' \
--data-urlencode 'bulk[0][pick_contact]=+6012-1234-5678' \
--data-urlencode 'bulk[0][pick_mobile]=+6017-1234-5678' \
--data-urlencode 'bulk[0][pick_addr1]=ppppp46/7 adfa' \
--data-urlencode 'bulk[0][pick_addr2]=test' \
--data-urlencode 'bulk[0][pick_addr3]=test' \
--data-urlencode 'bulk[0][pick_addr4]=' \
--data-urlencode 'bulk[0][pick_city]=NT' \
--data-urlencode 'bulk[0][pick_state]=NT' \
--data-urlencode 'bulk[0][pick_code]=14300' \
--data-urlencode 'bulk[0][pick_country]=MY' \
--data-urlencode 'bulk[0][send_name]=Sam' \
--data-urlencode 'bulk[0][send_company]=' \
--data-urlencode 'bulk[0][send_contact]=+6012-2134567' \
--data-urlencode 'bulk[0][send_mobile]=+6017-1234-5678' \
--data-urlencode 'bulk[0][send_addr1]=ssssadsasdst test' \
--data-urlencode 'bulk[0][send_addr2]=test test' \
--data-urlencode 'bulk[0][send_addr3]=test' \
--data-urlencode 'bulk[0][send_addr4]=' \
--data-urlencode 'bulk[0][send_city]=NT' \
--data-urlencode 'bulk[0][send_state]=NT' \
--data-urlencode 'bulk[0][send_code]=11950' \
--data-urlencode 'bulk[0][send_country]=MY' \
--data-urlencode 'bulk[0][collect_date]=2017-11-22' \
--data-urlencode 'bulk[0][sms]=1' \
--data-urlencode 'bulk[0][send_email][email protected]' \
--data-urlencode 'bulk[0][hs_code]=yshs_code' \
--data-urlencode 'bulk[0][reference]=order12321' \
--data-urlencode 'bulk[1][weight]=1' \
--data-urlencode 'bulk[1][width]=0' \
--data-urlencode 'bulk[1][length]=0' \
--data-urlencode 'bulk[1][height]=0' \
--data-urlencode 'bulk[1][content]=2017-09-14 - book' \
--data-urlencode 'bulk[1][value]=20' \
--data-urlencode 'bulk[1][service_id]=EP-CS0W' \
--data-urlencode 'bulk[1][pick_point]=' \
--data-urlencode 'bulk[1][pick_name]=Yong Tat' \
--data-urlencode 'bulk[1][pick_company]=Yong Tat Sdn Bhd' \
--data-urlencode 'bulk[1][pick_contact]=+6012-1234-5678' \
--data-urlencode 'bulk[1][pick_mobile]=+6017-1234-5678' \
--data-urlencode 'bulk[1][pick_addr1]=ppppp46/7 adfa' \
--data-urlencode 'bulk[1][pick_addr2]=test' \
--data-urlencode 'bulk[1][pick_addr3]=test' \
--data-urlencode 'bulk[1][pick_addr4]=' \
--data-urlencode 'bulk[1][pick_city]=NT' \
--data-urlencode 'bulk[1][pick_state]=NT' \
--data-urlencode 'bulk[1][pick_code]=14300' \
--data-urlencode 'bulk[1][pick_country]=MY' \
--data-urlencode 'bulk[1][send_name]=Sam' \
--data-urlencode 'bulk[1][send_company]=' \
--data-urlencode 'bulk[1][send_contact]=+6012-2134567' \
--data-urlencode 'bulk[1][send_mobile]=+6017-1234-5678' \
--data-urlencode 'bulk[1][send_addr1]=ssssadsasdst test' \
--data-urlencode 'bulk[1][send_addr2]=test test' \
--data-urlencode 'bulk[1][send_addr3]=test' \
--data-urlencode 'bulk[1][send_addr4]=' \
--data-urlencode 'bulk[1][send_city]=NT' \
--data-urlencode 'bulk[1][send_state]=NT' \
--data-urlencode 'bulk[1][send_code]=11950' \
--data-urlencode 'bulk[1][send_country]=MY' \
--data-urlencode 'bulk[1][collect_date]=2017-11-22' \
--data-urlencode 'bulk[1][sms]=1' \
--data-urlencode 'bulk[1][send_email][email protected]' \
--data-urlencode 'bulk[1][hs_code]=yshs_code' \
--data-urlencode 'bulk[1][reference]=order12321'Response
Response L1
| Field | Type | Description | Remarks |
|---|---|---|---|
api_ | string(10) | Validation result | (Refer to Appendix I) |
error_ | int(5) | Error code | (Refer to Appendix I) |
error_ | string(100) | Error message | (Refer to Appendix I) |
result | array | Result for making order | (Refer to Response L2) |
Response L2 · result
| Field | Type | Description | Remarks |
|---|---|---|---|
status | string(10) | The status of the orders made. | Fail / Success |
remarks | string(100) | The error message for orders made. | |
order_ | string(12) | The response of the order placed. | Failed = 0 / Success = (order_number) |
price | double(8,2) | Order price | |
courier | string(35) | The courier selected of the shipment |
Response samples
json
{
"api_status":"Success",
"error_code":"0",
"error_remark":"",
"result":[
{
"status":"Success",
"remarks":"Order Successfully Placed (Parcel from Pulau Pinang to Pulau Pinang)",
"order_number":"EI-AAY69",
"price":"6.00",
"courier":"Skynet"
},
{
"status":"Success",
"remarks":"Order Successfully Placed (Parcel from Pulau Pinang to Pulau Pinang)",
"order_number":"EI-AAY65",
"price":"6.00",
"courier":"Skynet"
}
]
}json
{
"api_status":"Error",
"error_code":"1",
"error_remark":"Required authentication key",
"result":[
]
}