Sendit

On-demand API Doc

Sendit On-demand API Document

Version 2.0

Sendit’s client who need to push the order to the system via API, can use the following information to create an order directly to our service and the order will appear on the client’s order history online.

Jump to Calculate API, Create Order API, Cancel Order API, Tracking API, Status Definition, Answers API, Update Pickup Address API

Calculate API

API Url

Method: POST

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Body

Order details in JSON format. All fields and scopes are explained in the following lines.

Request

            {
  "optimize": false, // if the client need Sendit to call the route optimization function in order to safe cost and give the shortest route to the driver
  "pickupAddress": [ //array of object, up to 3
    {
      "buildingName": "", //optional, point of interest e.g. apartment name, village name
      "streetNumber": "40", //unit number / house number
      "streetName": "Soi Silom 3", //street / road / soi
      "subDistrict": "",
      "district": "",
      "city": "Bangkok",
      "province": "",
      "country": "Thailand",
      "postcode": "10500", //post code in number format
      "lat": 13.7247119,
      "long": 100.53162420000001,
      "name": "ร้านไก่ย่างห้าดาวสาขาสีลม 40", //shop name
      "phone": "022222222" //shop phone
    }, {
      "buildingName": "",
      "streetNumber": "130",
      "streetName": "ซ. จุฬาฯ 5",
      "subDistrict": "",
      "district": "",
      "city": "Bangkok",
      "province": "",
      "country": "Thailand",
      "postcode": "10330",
      "lat": 13.580993,
      "long": 100.756239,
      "name": "ร้านไก่ย่างห้าดาวสาขาจุฬา",
      "phone": "022222222"
    }, {
      "buildingName": "TIP 8 Industrial Project",
      "streetNumber": "",
      "streetName": "",
      "subDistrict": "",
      "district": "",
      "city": "ตำบล บางปลา",
      "province": "ตำบล บางปลา",
      "country": "ไทย",
      "postcode": "10540",
      "lat": 13.580993,
      "long": 100.756239,
      "name": "ร้านไก่ย่างห้าดาวสาขาสุขุมวิท 26",
      "phone": "022222222"
    }
  ],
  "assignments": [ //assignment array, normally set to 1 assignment
    {
      "vehicleType": "MOTORCYCLE", //this is fix
      "note": "Instruction & order detail for Sendit Driver to order 5 Stars Chicken", //readable text for instruction
      "email": "customeremail@domain.com", //customer email
      "jobs": [ //detail of each drop-off location (5 jobs available for single assignment), normally we have 1
        {
          "deliveryFeeType": "RECIPIENT",
          "deliveryAddress": { //recipient address)
            "buildingName": "", //optional, point of interest e.g. apartment name, village name
            "streetNumber": "128/463", //unit number / house number
            "streetName": "Soi Thaiprakan Soi 1/6", //street / road / soi
            "subDistrict": "",
            "district": "",
            "city": "Tambon Bang Sao Thong",
            "province": "Tambon Bang Sao Thong",
            "country": "Thailand",
            "postcode": "10540", //post code in number format
            "lat": 13.5847746,
            "long": 100.77231269999993
          },
          "parcels": [ //5 parcels available for each job
            {
              "recipient": "Customer Name", //recipient name
              "phone": "Customer Phone", //recipient contact phone
              "note": "Optional note for driver", //information/instruction about the recipient e.g. floor number / how to access the building, etc.
              "services": [ //ROUND_TRIP: 0, DOCUMENT_PROCESSING: 1, MAILING_SERVICE: 2, PURCHASE_SERVICE: 3, CASH_ON_DELIVERY (with price data field): 4, FOOD_DELIVERY: 5, ID_APPROVAL: 6, INSURANCE (with price data field): 8)
                {
                  "type": 5
                },
                {
                  "data": {
                    "price": 5000
                  },
                  "type": 8
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
        

Response

            {
  "success": true,
  "result": {
    "transactionId": "HashNumberHere", //transactionId from server, we will use this for create order later.
    "calculation": [{
      "price": 222,
      "distance": 234,
      "distanceUnit": "meter"
    }, {
      "price": 234,
      "distance": 250,
      "distanceUnit": "meter"
    }, {
      "price": 250,
      "distance": 268,
      "distanceUnit": "meter"
    }]
  }
}
        

Create Order API

API Url

Method: POST

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Request

            {
  "transactionId": "HashNumberHere", //transaction id that Sendit response from Calculate API
  "pickupAt": "03/14/2016 11:50 AM" //pickup date and time (dd/mm/YYYY H:mm AA)
}
        

Response

            {
  "success": true,
  "result": {
    "order": {
      "id": 33039,
      "assignments": [
        {
          "id": 32456,
          "pickupAddress": [
            {
              "id": 27327
            },
            {
              "id": 27328
            },
            {
              "id": 27329
            }
          ],
          "jobs": [
            {
              "id": 56014
            }
          ]
        }
      ]
    }
  }
}
        

Cancel Order API

API Url

Method: DELETE

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Response

            {
  "success": true,
  "result": {
    "message": "Order {ORDER_ID} is now canceled!"
  }
}
        

Tracking API

API Url

Method: PUT

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Response

            {
  "success": true,
  "result": {
    "order": {
      "id": 33084,
      "status": 2,
      "statusMessage": "In Progress",
      "assignments": [
        {
          "id": 32290,
          "status": 2,
          "statusMessage": "In Progress",
          "job": [
            {
              "id": 68803,
              "status": 1,
              "statusMessage": "Assigned"
            }
          ]
        }
      ]
    }
  }
}
        

Status Definition

Order / Assignment / Job

Status Code Description Apply to
0 UNASSIGNED Order / Assignment / Job
1 ASSIGNED Order / Assignment / Job
2 IN_PROGRESS Order / Assignment / Job
3 PARTIALLY_COMPLETE Order / Assignment / Job
4 COMPLETED Order / Assignment / Job
5 FAILED Order / Assignment / Job
6 CANCELLED Job

Parcel

Status Code Description
0 UNASSIGNED
1 ACCEPTED
2 DELIVERED
3 FAILED
4 CANCELLED
5 DECLINED
6 LOGISTIC_CENTRE
7 PICKED_UP
8 DISCARDED
9 WE_BROKE_IT

Service Type

Service Code Description Remark
0 ROUND_TRIP Will create last job with type "return_sender"
1 DOCUMENT_PROCESSING
2 MAILING_SERVICE
3 PURCHASE_SERVICE Need to add "round trip"
4 CASH_ON_DELIVERY
5 FOOD_DELIVERY
6 ID_APPROVAL
7 NO_SERVICE

Pickup Answers API

Description

This API is for customer who want to list Answers for Sendit's driver to answer when choose not to go prefer shop

List Answers

API Url

Method: GET

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Response

            {
  "success": true,
  "result": {
    "pickupAnswer": [{
      "id": 1,
      "answer": "ร้านไกลกว่า"
    }, {
      "id": 2,
      "answer": "ร้านปิด"
    }, {
      "id": 3,
      "answer": "ติดต่อไม่ได้"
    }]
  }
}
        

Create Answer

API Url

Method: POST

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Request

            {
  "pickupAnswer": ["สินค้าไม่ครบ", "ราคาไม่ตรง"]
}
        

Response

            {
  "success": true,
  "result": {
    "pickupAnswer": [{
      "id": 4,
      "answer": "สินค้าไม่ครบ"
    }, {
      "id": 5,
      "answer": "ราคาไม่ตรง"
    }]
  }
}
        

Update Answer

API Url

Method: PUT

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Request

            {
  "pickupAnswer": "สินค้าไม่มี"
}
        

Response

            {
  "success": true,
  "result": {
    "pickupAnswer": {
      "id": 4,
      "answer": "สินค้าไม่ครบ"
    }
  }
}
        

Delete Answer

API Url

Method: DELETE

Headers

Content-Type application/json
Authorization basic {SENDIT_TOKEN}

Response

            {
  "success": true,
  "result": {
    "message": "Answer {ANSWER_ID} - {ANSWER} is now deleted!"
  }
}
        

Update Answer

JSON Format

            {
    "assignment": {
      "id": 33084,
      "answer": {
        "id": 4,
        "answer": "สินค้าไม่ครบ"
      }
}
        

Update Pickup Address API

Description

This JSON object use for update answer for multiple pick up order

JSON

            {
    "assignment": {
      "id": 33084,
      "pickupAddressId": 4039
    }
}
        

For further information and/or if you have a question, please contact dev@sendit.asia.