Skip to main content
Add Delivery
Fin avatar
Written by Fin
Updated over a year ago

ADD DELIVERIES

URL:

https://app.detrack.com/api/v1/deliveries/create.json

Limit:

100 deliveries per request (send separate requests if you are adding more than 100 deliveries)

HTTP POST REQUEST

Note: the request structure below is for Method #1: Name/Value Pair (NVP) + JSON String. For Method #2: Custom Header + JSON Body, please refer to the jsonparameter only.

Field

Description

date

The delivery date. Format: YYYY-MM-DD e.g. 2014-02-28. Required field.

do

The D.O. #. This field must be unique for the date. Required field.

address

The delivery address. Always include country name for accurate geocoding results. Required field.

delivery_time

The delivery time window. This will be displayed in the job list view and the delivery detail view on the app.

deliver_to

The name of the recipient to deliver to. This can be a person’s name e.g. John Tan, a company’s name e.g. ABC Inc., or both e.g. John Tan (ABC Inc.)

phone

The phone number of the recipient. If specified, the driver can call the recipient directly from the app.

notify_email

The email address to send customer-facing delivery updates to. If specified, a delivery notification will be sent to this email address upon successful delivery.

notify_url

The URL to post delivery updates to.

assign_to

The name of the vehicle to assign this delivery to. This must be spelled exactly the same as your vehicle’s name in your dashboard.

instructions

Any special delivery instruction for the driver. This will be displayed in the delivery detail view on the app.

zone

If you divide your deliveries into zones, then specifying this will help you to easily filter out the deliveries by zones in your dashboard.

Items level (Optional)

Field

Description

sku

Stock keeping unit or item #. Required for item only.

desc

The item description. Required for item only.

qty

Quantity of the item to be delivered. Required for item only.

HTTP POST RESPONSE (JSON)

Field

Description

status

The status of the request. The value will be “ok” if request is processed successfully or “failed” if the key or json parameter is missing.

failed

The number of deliveries that are not added due to error.

error

Contains the error details if the request failed. Note: this field is set only if the request failed.

Field Description code The error code. Please refer to Delivery Error Codes message The corresponding error message.

Field

Description

date

The date of the delivery. Format: YYYY-MM-DD e.g. 2014-02-28

do

The D.O. # of the delivery.

status

The status of the delivery add request. The value will be “ok” if the delivery is successfully added or “failed” if the delivery is not added.

errors

Contains an array of error messages if the delivery add request failed. Note: this field is set only if the delivery add request failed.

Field Description code The error code.

SAMPLE REQUEST JSON

[
   {
      "date":"2014-02-11",
      "do":"DO140211001",
      "address":"63 Ubi Avenue 1 Singapore 408937",
      "delivery_time":"09:00 AM - 12:00 PM",
      "deliver_to":"John Tan",
      "phone":"+6591234567",
      "notify_email":"john.tan@example.com",
      "notify_url":"http://www.example.com/notify.php",
      "assign_to":"GT1234H",
      "instructions":"Call customer upon arrival.",
      "zone":"East",
      "items":[
         {
            "sku":"T0201",
            "desc":"Test Item #01",
            "qty":1
         },
         {
            "sku":"T0202",
            "desc":"Test Item #02",
            "qty":5
         },
         {
            "sku":"T0203",
            "desc":"Test Item #03",
            "qty":10
         }
      ]
   },
   {
      "date":"2014-02-11",
      "do":"DO140211002",
      "address":"59 Ubi Avenue 1 Singapore 408938",
      "delivery_time":"02:00 PM - 05:30 PM",
      "deliver_to":"Jane Lim",
      "phone":"+6581234567",
      "notify_email":"jane.lim@example.com",
      "notify_url":"http://www.example.com/notify.php",
      "assign_to":"GT1234H",
      "instructions":"Change pass at security counter before proceeding to level 3.",
      "zone":"East",
      "items":[
         {
            "sku":"T0211",
            "desc":"Test Item #11",
            "qty":1
         },
         {
            "sku":"T0212",
            "desc":"Test Item #12",
            "qty":5
         },
         {
            "sku":"T0213",
            "desc":"Test Item #13",
            "qty":10
         }
      ]
   }
]

SAMPLE RESPONSE JSON #1

{
   "info":{
      "status":"ok",
      "failed":0
   },
   "results":[
      {
         "date":"2014-02-13",
         "do":"DO140213001",
         "status":"ok"
      },
      {
         "date":"2014-02-13",
         "do":"DO140213002",
         "status":"ok"
      }
   ]
}

SAMPLE RESPONSE JSON #2

{
   "info":{
      "status":"ok",
      "failed":2
   },
   "results":[
      {
         "date":"2014-02-13",
         "do":"DO140213001",
         "status":"failed",
         "errors":[
            {
               "code":1002,
               "message":"Delivery with D.O. # DO140213001 already exists on 2014-02-13."
            }
         ]
      },
      {
         "date":"2014-02-13",
         "do":"DO140213002",
         "status":"failed",
         "errors":[
            {
               "code":1002,
               "message":"Delivery with D.O. # DO140213002 already exists on 2014-02-13."
            }
         ]
      }
   ]
}
Did this answer your question?