Edit Collection
Operator avatar
Written by Operator
Updated over a week ago

Edit Collection

URL:

https://app.detrack.com/api/v1/collections/update.json

Limit:

100 collections per request (send separate requests if you are editing more than 100 collections)

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 json parameter only.

Field

Description

date

The collection 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 collection address. Always include country name for accurate geocoding results.

collection_time

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

collect_from

The name of the sender to collect from. 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 sender. If specified, the driver can call the sender directly from the app.

notify_email

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

notify_url

The URL to post collection updates to. Please refer to Collection Push Notification

assign_to

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

instructions

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

zone

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

Item-level

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 collected. 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 collections that are not edited due to error.

error

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

Field

Description

date

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

do

The D.O. # of the collection.

status

The status of the collection edit request. The value will be “ok” if the collection is successfully edited or “failed” if the collection is not edited.

errors

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

SAMPLE REQUEST JSON

[
   {
      "date":"2014-02-13",
      "do":"DO140213001",
      "address":"63 Ubi Avenue 1 Singapore 408937",
      "collection_time":"09:00 AM - 12:00 PM",
      "collect_from":"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-13",
      "do":"DO140213002",
      "address":"59 Ubi Avenue 1 Singapore 408938",
      "collection_time":"02:00 PM - 05:30 PM",
      "collect_from":"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":"DO140213003",
         "status":"failed",
         "errors":[
            {
               "code":1003,
               "message":"Collection with D.O. # DO140213003 not found on 2014-02-13."
            }
         ]
      },
      {
         "date":"2014-02-13",
         "do":"DO140213004",
         "status":"failed",
         "errors":[
            {
               "code":1003,
               "message":"Collection with D.O. # DO140213004 not found on 2014-02-13."
            }
         ]
      }
   ]
}
Did this answer your question?