This API is to be used by you to provide updates to any of the pending orders. You are
required to provide an order number, a list of order line items that are affected by this
event, and whether this event is a cancellation or despatch.
You are also expected to have made a request to the authenticate API beforehand to have
successfully logged in, and to provide the session cookie given in the authenticate response
in the request to this API.
Parameters
| Name | Notes |
| supplier_id | (required) your id, passed to you from the authenticate api, to confirm who you are. |
| order_number | (required) the order number for which items are being despatched/cancelled. |
| cancel | (optional) determines whether the event is a cancellation or despatch. By default if not provided it is despatch. May either be 1 for cancel, or 0 for despatch. |
| item_arr | (required) array of items that are being despatched/cancelled. Each entry in the array must be of the format: { "code": "123"," qty": 1} |
| item_arr[]['code'] | (required) product code used by you to identify a product ( (Please note this is your reference for the product, not the ranges SKU) |
| item_arr[]['qty'] | (required) quantity of being despatched or cancelled in this event. |
| cancel_code | (optional) this is only used if the items are being cancelled. The following codes are acceptable: "Stock not available", "Unable to contact customer to arrange delivery", "Unable to deliver to address" |
| cancel_reason | (optional) this is only used if the items are being cancelled. This may be any free text reason for the cancellation. |
| delivery_service | (required) this is required only if the event is a despatch. This must contain the name of a delivery service that has been set up for this supplier in Kube. |
| courier_name | (required) this is required only if the event is a despatch. Free text name of the courier used for despatch. |
| despatch_date | (required) this is required only if the event is a despatch. This must contain date the items are being despatched. Must be of the format "Y-m-d H:i:s" |
| earliest_delivery | (optional) this is required only if the event is a despatch. This must contain the earliest estimated date the delivery will arrive. Must be of the format "Y-m-d". |
| latest_delivery | (optional) this is required only if the event is a despatch. This must contain the latest estimated date the delivery will arrive. Must be of the format "Y-m-d". |
| tracking_reference | (required) this is required only if the event is a despatch. Tracking reference for the despatch. |
| mode | (required) either "Test", or "Live", the expected mode the supplier account is in. |
Example Request
Example Despatch
https://supplier.rstore.com/rest/order_event.api?supplier_id=1
With JSON Content:
{
"order_number": "W000001-1D-S",
"delivery_service": "Mainland",
"courier_name": "Royal Mail",
"despatch_date": "2016-05-20 15:00:00",
"earliest_delivery": "2016-05-21",
"latest_delivery": "2016-05-23",
"tracking_reference": "GB12345AB",
"item_arr": [
{
"code": "123456",
"qty": 2
},
{
"code": "654321",
"qty": 1
}
],
"mode": "Test"
}
With Cookie Header:
Cookie: "ksi=abcdefghijklmnopqrstuvwxyz123"
Example Cancellation
https://supplier.rstore.com/rest/order_event.api?supplier_id=1
With JSON Content:
{
"order_number": "W000001-1D-S",
"cancel": 1,
"cancel_code": "Stock not available",
"cancel_reason": "There wasn't any stock around after all",
"item_arr": [
{
"code": "123456",
"qty": 2
},
{
"code": "654321",
"qty": 1
}
],
"mode": "Test"
}
With Cookie Header:
Cookie: "ksi=abcdefghijklmnopqrstuvwxyz123"
Responses
On Success:
{
"result":[
{
"label": "order_event",
"order_number":"W000001-1D-S"
}
]
}
On Missing Cookie, or Not Logged In
HTTP/1.0 401 Not Authenticated
User not authenticated
On Invalid Json Provided:
HTTP/1.0 400 Invalid Request
Invalid json provided
On Missing/Incorrect Supplier Parameter
HTTP/1.0 400 Invalid Request
User not authorised to save this supplier's orders
On Invalid Supplier Parameter
HTTP/1.0 400 Invalid Request
No supplier found with id 123
On Expected Mode being "Live", but Supplier Account is "Test"
HTTP/1.0 400 Invalid Request
Supplier is currently in Test Mode, but expected Live Mode
On Expected Mode being "Test", but Supplier Account is "Live"
HTTP/1.0 400 Invalid Request
Supplier is currently in Live Mode, but expected Test Mode
On Missing Order Number Parameter
HTTP/1.0 400 Invalid Request
Order number is required
On Invalid Order Number Parameter
HTTP/1.0 400 Invalid Request
No order record found for order number W000001-1D-S
50
On Invalid/No Data Provided
HTTP/1.0 400 Invalid Request
At least one item is required to be despatched or cancelled
On Missing Product Code
HTTP/1.0 400 Invalid Request
The product's code is a required parameter
On Missing Quantity
HTTP/1.0 400 Invalid Request
Quantity to cancel/despatch is a required parameter
On Invalid Product Code
HTTP/1.0 400 Invalid Request
No order item found with product code "123456" for order W000001-1D-S
On Attempt to Cancel already Cancelled Product
HTTP/1.0 400 Invalid Request
Order item with product code "123456" is already cancelled
On Attempt to Cancel/Despatch already Despatched Product
HTTP/1.0 400 Invalid Request
Order item with product code "123456" is already despatched
On Missing Delivery Service
HTTP/1.0 400 Invalid Request
Delivery Service for despatch is required
On Missing Courier Name
HTTP/1.0 400 Invalid Request
Courier Name is required
On Missing Tracking Reference
HTTP/1.0 400 Invalid Request
Tracking Reference is required
On Invalid Delivery Service
HTTP/1.0 400 Invalid Request
No delivery service found with name "RM Saver Delivery"
On Missing Despatch Date
HTTP/1.0 400 Invalid Request
Despatch Date is required
On Invalid Despatch Date
HTTP/1.0 400 Invalid Request
Invalid Despatch Date provided
On Missing Earliest Delivery Date
HTTP/1.0 400 Invalid Request
Earliest Delivery Date is required
On Invalid Earliest Delivery Date
HTTP/1.0 400 Invalid Request
Invalid Earliest Delivery Date provided
On Missing Latest Delivery Date
HTTP/1.0 400 Invalid Request
Latest Delivery Date is required
On Invalid Latest Delivery Date
HTTP/1.0 400 Invalid Request
Invalid Latest Delivery Date provided
On Invalid Despatch Date compared to Order Placed Date
HTTP/1.0 400 Invalid Request
Despatch Date/Time must be after the date the order was placed
On Invalid Earliest Delivery Date compared to Despatch Date
HTTP/1.0 400 Invalid Request
Earliest Delivery Date must be the same date or after the Despatch Date
On Invalid Latest Delivery Date compared to Latest Delivery Date
HTTP/1.0 400 Invalid Request
Latest Delivery Date must be the same date or after the Earliest Delivery Date
Comments
0 comments
Article is closed for comments.