- Created by Jayson Catacutan , last modified by Emmanuel Nipal on Sept 11, 2020
You are viewing an old version of this page. View the current version.
Compare with Current View Version History
« Previous Version 29 Next »
Endpoint URL
Staging | |
---|---|
Production | will be provided after SIT |
Login and Get Session Token BUSINESS PROVIDER
Description | To acquire authorization token |
---|---|
Endpoint | /login |
Method | POST |
Request Headers
{ "Content-Type": "application/json" }
Request Body
Field | Data type | Required | Description |
---|---|---|---|
string | yes | email credential | |
password | string | yes | password |
Sample Request Body
{ "email": "sandbox_dev@gmail.com", "password": "password" }
Sample Response
Status: 200 OK! { "success": true, "results": { "apiKey": "fb77c9653bf5e736d191b46bbfed7c2bd", "clientId": "SANDBOX_DEV", "sessionToken": "b45e2fb77c9653bf5e736d19e1fd18ebbffd0f6d3dd25af118e5eb38851bf4d" } }
Field | Description |
---|---|
apiKey | Generated hash on client-side to be used on succeeding API request |
clientId | Reference Client ID |
sessionToken | Generated hash on every API login to be used on succeeding API requests. |
Get Partners BUSINESS PROVIDER
Description | To get the list of your preferred partners |
---|---|
Endpoint | /getPartners |
Method | GET |
Request Headers
{ "Auth-Token": "<Auth token acquired on api LOGIN>" }
URL Query parameters
{ "apiKey": "<apiKey will be acquired on login API>" }
Sample Response
Status: 200 OK! { "success": true, "results": [ { "id": "SANDBOX_BUSINESS", "name": "Sandbox Business" }, { "id": "SANDBOX_QA", "name": "Sandbox_Qa" } ] }
Update Post Status PROVIDER
Description | To Update post status |
---|---|
Endpoint | /updatePostStatus |
Method | POST |
Request Headers
{ "Auth-Token": "<Auth token acquired on api LOGIN>", "Content-Type": "application/json" }
URL Query parameters
{ "apiKey": "<apiKey will be acquired on login API>" }
Request Body Fields
Field | Data Type | Required | Description |
---|---|---|---|
postId | string | yes | ID of post to update. |
status | string | yes | status to update |
remarks | string | no | update remarks from provider |
timeStamp | number | no | timestamp in millisecond. Leave 0, null or empty string to use current time. |
metaState | string | no | custom status/state from provider |
Sample Request Body
{ "postId": "uuNzkYoOy1VI373BoKY9", "status": "START_DELIVERY", "remarks": "Rider is on his way", "timeStamp": 1575890011178, "metaState": "" }
Sample Response
Status: 200 OK! { "success": true, "message": "Post successfully updated." }
Status Updates:
Status | Description |
| Order is for pickup |
| Order is out for delivery |
| Order has been delivered |
| Failed to pickup order |
| Failed to deliver order |
| Failed to return order |
| Cancel order |
| Order is out for return |
| Order has been returned to sender |
| Push an event update on job history without updating the status of the post. Please use the remarks field. |
Get Post BUSINESS PROVIDER
Description | To get a specific post or all post |
---|---|
Endpoint | /getPost |
Method | GET |
Request Headers
{ "Auth-Token": "<Auth token acquired on api LOGIN>" }
URL Parameters (Query Parameters)
Parameter | Required | Description |
---|---|---|
apiKey | yes | API key from Login API |
postId | no | filter by post id, leave empty or remove postId parameter to query all |
partnerId | no | filter by partner id, leave empty or remove partnerId parameter to query all |
type | no | Post type which can be either of the following:
Defaults to opportunity if empty or undefined. |
status | no | filter by status. set to |
Sample URL Parameters
{ "apiKey": "fb77c9653bf5e736d191b46bbfed7c2bd", "postId": "uuNzkYoOy1VI373BoKY9", "partnerId": "SANDBOX_DX" }
Sample Response:
Status: 200 OK! { "success": true, "result": [ { "postId": "uuNzkYoOy1VI373BoKY9", "customerName": "Christian Pick up", "contactNumber": "09123456789", "emailAddress": "a@gmail.com", "completionDateTime": 1583836200000, "pickupAddress": "Sitio barrio, Angeles Pampanga Philippines", "pickupCity": "Mandaluyong City", "province": "Metro Manila", "lat": 14.5776292, "long": 121.0463673, "tags": [ "-LI4Qgef9HIHhb2AzGzW", "-LK5fMS1u-Qsv-G1tc9l" ], "metaTags": "{\"-LI4Qgef9HIHhb2AzGzW\":{\"colorIndex\":1,\"label\":\"API\"},\"-LK5fMS1u-Qsv-G1tc9l\":{\"colorIndex\":4,\"label\":\"Pick-up\"}}", "storeName": "", "remarks": "my remarks", "businessId": "SANDBOX_DEV", "businessName": "Sandbox_Dev", "businessStoreId": null, "storeId": null, "courierName": "Sandbox_DX", "createdAt": 1583381948826, "partnerId": "SANDBOX_DX", "refNo": "order-001", "status": "ASSIGNED", "meta": "{\"customerName\":\"Christian Delivery\",\"contactNumber\":\"09123456789\",\"emailAddress\":\"a@gmail.com\",\"completionDateTime\":1583928900000,\"deliveryAddress\":\"Vermont Royale, Antipolo\",\"deliveryCity\":\"Antipolo\",\"province\":\"Rizal\",\"itemPrice\":200,\"dimension\":\"fff\",\"actualShippingCost\":50,\"codAmount\":250,\"lat\":14.5776292,\"long\":121.0463673,\"tags\":[\"-LI4Qgef9HIHhb2AzGzW\",\"-LK5fK2Pq--uEhN4T9UG\"],\"details\":\"my details\",\"remarks\":\"my remarks\",\"metaTags\":\"{\\\"-LI4Qgef9HIHhb2AzGzW\\\":{\\\"colorIndex\\\":1,\\\"label\\\":\\\"API\\\"},\\\"-LK5fK2Pq--uEhN4T9UG\\\":{\\\"colorIndex\\\":3,\\\"label\\\":\\\"Delivery\\\"}}\"}", "metaFields": {} }, ] }
Update Meta Fields PROVIDER
Description | To update tracking number and tracking url of a post. For providers only |
---|---|
Endpoint | /updateMetaFields |
Method | POST |
Request Headers
{ "Auth-Token": "<Auth token acquired on api LOGIN>", "Content-Type": "application/json" }
Query parameters (URL)
{ "apiKey": "<apiKey will be acquired on login API>" }
Request Body Fields
Field | Data Type | Required | Description |
---|---|---|---|
postId | string | yes | id of post to update. |
trackingNumber | string | no | tracking number |
trackingUrl | string | no | tracking URL |
Fields under metaFields requires at least one field to update.
Undefined meta fields will not be updated.
Sample Request Body
{ "postId": "uuNzkYoOy1VI373BoKY9", "metaFields": { "trackingNumber": "ORDER-001-AKS-ASV", "trackingUrl": "https://trackmyorder.com/track?id=ORDER-001-AKS-ASV" } }
Sample Response
Status: 200 OK! { "success": true, "message": "Post successfully updated." }
Get Partner Metafields INTERNAL
Description | To get metafields of all or a specific provider. For internal use of DPH |
---|---|
Endpoint | /getPartnersMetaFields |
Method | GET |
Request Headers
{ "Content-Type": "application/json" "Auth-Token": "<Auth token acquired on api LOGIN>" }
Query parameters (URL):
{ "apiKey": "<apiKey will be acquired on login API>", "partnerId": "<provider's id, can be acquired on getPartners API>" }
Note: Empty partnerId url params will fetch all of your partners' metafields.
Sample Response with valid partnerId:
Status: 200 OK! { "success": true, "result": { "goods": { "active": true } } }
Sample Response for empty partnerId
Status: 200 OK! { "success": true, "result": { "SANDBOX_BA": { "goods": { "active": true } }, "SANDBOX_PROVIDER": {}, "SANDBOX_QA": { "cod": { "required": true, "active": true, "key": "cod", "fieldType": "string", "placeholder": "COD" }, "name": { "fieldType": "string", "placeholder": "Name", "required": false, "active": true, "key": "name" }, "insurance": { "required": true, "active": true, "key": "insurance", "fieldType": "string", "placeholder": "Insurance" }, "vehicleType": { "options": [ { "value": "car", "label": "Car" }, { "value": "motorcycle", "label": "Motorcycle" } ], "required": false, "active": true, "key": "vehicleType", "placeholder": "Vehicle Type", "fieldType": "dropdown" } } } }
Sample Response with invalid partnerId
Status: 400 Bad Request { "success": false, "message": "Invalid partner id. Neither it's not existing or you don't have rights to post to the partner." }
Sample Response with no partner:
Status: 400 Bad Request { "success": false, "message": "No preferred partners yet. Please invite a partner in Deliveries PH - My Partners" }
Get Provider's Create Post Template BUSINESS
Description | Get provider’s create post template and meta fields schema for createPostv2 API. For integration only |
---|---|
Endpoint | /getCreatePostTemplate |
Method | GET |
Request Headers
{ "Auth-Token": "<Auth token acquired on api LOGIN>" }
URL Parameters
Field | Required | Description |
---|---|---|
apiKey | yes | API key from login API |
partnerId | yes | Client id of desired partner’s create post template and meta fields schema. Can be acquired through getPartners API |
Sample Request
https://us-central1-fleet-dev-ph.cloudfunctions.net/getCreatePostTemplate?apiKey=7c5dd55738b964944f9357bcc7f45ce6d857ff18&partnerId=SANDBOX_DX
Sample Response
status: 200 OK! { "success": true, "result": { "requestBody": { "refNo": "", "pickupDetails": { "customerName": "", "contactNumber": "", "emailAddress": "", "completionDateTime": "", "lat": 0, "long": 0, "tags": [], "remarks": "", "barangay": "", "province": "", "postalCode": "", "pickupAddress": "", "pickupCity": "" }, "deliveries": [ { "customerName": "", "contactNumber": "", "emailAddress": "", "completionDateTime": "", "lat": 0, "long": 0, "tags": [], "remarks": "", "barangay": "", "province": "", "postalCode": "", "deliveryAddress": "", "deliveryCity": "", "details": "", "dimension": "", "itemPrice": 0, "codAmount": 0, "metaFields": { "stringType": "", "dropdownType": "", "listType": [ { "quantity": "", "itemName": "" } ] } } ] }, "metaFieldSchema": { "stringType": { "required": false, "type": "string", "description": "Sample string type meta" }, "dropdownType": { "required": true, "type": "string", "description": "Dropdown sample", "values": [ "car", "van" ], "details": [ { "value": "car", "description": "Car" }, { "value": "van", "description": "Van" } ] }, "listType": { "type": "object", "description": "List sample", "properties": { "quantity": { "description": "Quantity", "required": true, "type": "string" }, "itemName": { "description": "Item Name", "required": true, "type": "string" } } } } } }
Meta fields schema
Field | Data type | Description |
---|---|---|
type | string | data type of a meta field. Can either be object or string |
required | boolean | indicator if meta field is required |
description | string | description of a meta field |
values | array | options/values for the specified meta field |
details | array | in depth description of options/values |
properties | object | details for object type meta fields |
Update Fee PROVIDER
Description | To pass or update fees of a post. For providers only |
---|---|
Endpoint | /updateFee |
Method | POST |
Request Headers
{ "Auth-Token": "<Auth token acquired on api LOGIN>", "Content-Type": "application/json" }
Query parameters (URL)
{ "apiKey": "<apiKey will be acquired on login API>" }
Request Body Fields
Field | Data Type | Required | Description |
---|---|---|---|
postId | string | yes | ID of post to be updated. |
remarks | string | no | short description or remarks of the update |
fees | array | yes | breakdown of fees |
Fees object fields
Field | Data Type | Required | Description |
---|---|---|---|
value | number | yes | amount of fee |
type | string | yes | type of fee, must be of the following:
|
List of fees must contain at least one value with fee type of shipping or return.
Type of fee must be unique to other fees within the list.
Sample Request Body
{ "postId": "Wq9FPWxCYVxNgrPrn08D", "remarks": "Shipping fee from upon booking.", "fees": [ { "value": 100, "type": "shipping" }, { "value": 20, "type": "insurance" } ] }
Sample Response
status: 200 OK! { "success": true, "result": "Post successfully updated." }
Responses (Success and Errors)
Status | Message | Description |
---|---|---|
200 | OK | Success |
400 | Bad Request | We could not understand the request due to invalid syntax or invalid parameters. |
401 | Unauthorized | Your apiKey can be missing or invalid. Your auth-token is not valid or may have already expired. |
500 | Internal Server Error | Unhandled exception. Please contact the production team when you encounter this error. |
- No labels