### On-demand JSON request example Source: https://github.com/easyparcel/nextgen-integration-doc/blob/main/NextGenSwitches/legacy_ondemand_api.md Example HTTP request for an on-demand action. The body must be JSON, not form-encoded, because waypoints and packages are nested objects. Every action requires the `api` field with your EasyParcel API key as a top-level body field; there is no separate header or bearer token. ```http POST /?ac=OndemandQuotation HTTP/1.1 Host: connect.easyparcel.my Content-Type: application/json { "api": "YOUR_API_KEY", "waypoint": [ ... ] } ``` -------------------------------- ### OndemandQuotation Source: https://github.com/easyparcel/nextgen-integration-doc/blob/main/NextGenSwitches/legacy_ondemand_api.md Gets the couriers and prices for a route based on pickup and drop-off coordinates. This action is free and does not charge the account. ```APIDOC ## [POST] /?ac=OndemandQuotation ### Description Gets the couriers and prices for a route based on pickup and drop-off coordinates. This action is free and does not charge the account. ### Method POST ### Endpoint https://connect.easyparcel.my/?ac=OndemandQuotation ### Parameters #### Request Body - **api** (string) - Required - Your EasyParcel API key. - **waypoint** (array) - Required - List of waypoints (pickup and drop-off) with coordinates. ### Request Example { "api": "YOUR_API_KEY", "waypoint": [ ... ] } ### Response #### Success Response (200) - **api_status** (string) - "Success" when the request was authenticated and understood, "Error" otherwise. - **error_code** (string) - "0" on success. Anything else is a failure. - **error_remark** (string) - Human-readable reason, safe to surface to a merchant. - **result** (object) - The payload. Shape depends on the action. #### Response Example { "api_status": "Success", "error_code": "0", "error_remark": "", "result": { } } ``` -------------------------------- ### Typical on-demand API flow Source: https://github.com/easyparcel/nextgen-integration-doc/blob/main/NextGenSwitches/legacy_ondemand_api.md Lists the four on-demand API actions in the order they are typically called: quotation, place order, order details, and cancel order. Quoting is free and does not charge the wallet; only OndemandPlaceOrder charges the account. ```text 1. OndemandQuotation get the couriers and prices for that route 2. OndemandPlaceOrder book one of them -> order_number 3. OndemandOrderDetails poll for driver, status and tracking 4. OndemandCancelOrder cancel while it is still cancellable ``` -------------------------------- ### OndemandPlaceOrder request JSON Source: https://github.com/easyparcel/nextgen-integration-doc/blob/main/NextGenSwitches/legacy_ondemand_api.md Request body for OndemandPlaceOrder. Requires api, service_id (from OndemandQuotation), and waypoint array with pickup/dropoff points. Each waypoint needs type, coordinates, address, contact info, and at least one package; weight is in grams (e.g., 1200 for 1.2 kg). ```json { "api": "YOUR_API_KEY", "service_id": "EP-CS0K3M2P", "pickup_date": "2026-09-12", "pickup_time": "14:30:00", "waypoint": [ { "type": "pickup", "latitude": 3.1421, "longitude": 101.6871, "address": "12 Jalan Example, 50450 Kuala Lumpur", "name": "Store Front", "email": "store@example.com", "phone_number_country_code": "60", "phone_number": "123456789", "remark": "Counter is on the ground floor", "packages": [ { "name": "T-shirt", "quantity": 2, "height": 10, "width": 20, "depth": 15, "weight": 1200 } ] }, { "type": "dropoff", "latitude": 3.1580, "longitude": 101.7120, "address": "88 Jalan Sample, 50200 Kuala Lumpur", "name": "Buyer Name", "email": "buyer@example.com", "phone_number_country_code": "60", "phone_number": "198765432", "remark": "Leave with the guard house", "packages": [ { "name": "T-shirt", "quantity": 2, "height": 10, "width": 20, "depth": 15, "weight": 1200 } ] } ] } ``` -------------------------------- ### OndemandQuotation response JSON Source: https://github.com/easyparcel/nextgen-integration-doc/blob/main/NextGenSwitches/legacy_ondemand_api.md Example response from the OndemandQuotation endpoint. The result array contains one quote per courier service; an empty array means no courier serves the route at that time, which is a legitimate answer, not an error. The service_id is opaque and must be passed back to OndemandPlaceOrder verbatim. ```json { "api_status": "Success", "error_code": "0", "result": [ { "service_id": "EP-CS0K3M2P", "courier": "Lalamove", "courier_image": "https://.../lalamove.png", "transportation_type": "Motorcycle", "parcel_type_support": "Document, Parcel", "max_weight": "20 kg", "max_dimension": "40 x 40 x 40 cm", "estimate_durations": "30 mins", "estimate_price": 9.8, "currency": "MYR" } ] } ```