LLSR API - Shopping Cart API Specification and Examples
Root Nodes
/cart Shopping Cart API root node
/cart/orders The set of all orders
/cart/orders
Reading
Details of orders previously committed via the shopping cart API can be queried through the orders node. The following example shows how the /cart/orders endpoint is used to achieve this:
GET /cart/orders/ABC123 HTTP/1.1
Host: api.skilouise.com
In this example, a query on the order ABC123 might generate the following JSON-encoded result:
{
"code":"ABC123",
"url":"https://shop.skilouise.com/order/ABC123",
"items":[
{
"order_item_id":12345
"id":123,
"sku":"TEST123",
"description":"Test Product",
"qty":1,
"date_committed":"Jan 6 2021 09:16:30:310AM",
"date_available":"Jan 6 2021 09:16:30:310AM",
"qty_redeemed":0
"date_redeemed":null,
"employee_redeemed_by":null,
"location_redeemed":null,
"redemption_note":null,
"redemption_note_description":"Comments",
"redemption_note_required":0,
"outlet_name":"Test Store",
"outlet_product_id":99998
},
{
"order_item_id":12346
"id":456,
"sku":"TEST456",
"description":"Test Product 2 - Advance Purchase Only",
"qty":1,
"date_committed":"Jan 6 2021 09:16:31:211AM",
"date_available":"Jan 7 2021 12:00:00:000AM",
"qty_redeemed":0
"date_redeemed":null,
"employee_redeemed_by":null,
"location_redeemed":null,
"redemption_note":null,
"redemption_note_description":"Comments",
"redemption_note_required":0,
"outlet_name":"Test Store",
"outlet_product_id":99999
}
],
"notices":[
]
}
If the order ABC123 did not exist, the following error result would be generated:
{
"error":{
"message":"Order could not be retrieved/does not exist"
}
}
Publishing
Orders that do not already exist in the system are automatically published through an update. For further details, see the Updating section.
Updating
Committing Orders
Once a customer has placed an order, the Shopping Cart API must be called for each item in the customer's order. The following example shows how the /cart/orders endpoint is used to achieve this:
POST /cart/orders/ABC123/items HTTP/1.1
Host: api.skilouise.com
itemID=999&itemQty=2
In this example, 2 items of ID #999 are added to the order ABC123.
If no order ABC123 exists, the order will be created, and 2 items of ID 999 added to it.
If successful, the following JSON-encoded result would be generated:
{
"code":"ABC123",
"url":"https://shop.skilouise.com/order/ABC123",
}
Error:
{
"error":{
"message":"Failed to commit order item"
}
}
Redeeming Orders
Upon receiving the order, sales staff can mark an item on that customer's order as purchased by updating that item's endpoint:
POST /cart/orders/ABC123/items/999 HTTP/1.1
Host: api.skilouise.com
qtyRedeemed=1&employeeID=43&locationID=76
In this example, 1 item of ID #999 is marked as redeemed on order ABC123, by employee 43 at location 76. This would leave 1 of 2 remaining for future redemption (unless the other item #999 had already been collected prior).
Note that the item ID is distinct from its SKU. Item IDs can be obtained by reading the /cart/orders endpoint; see the Reading section for further details.
Note also that employee and location IDs are outlet-dependent.
If successful, the following JSON-encoded result would be generated:
{
"code":"ABC123",
"url":"https://shop.skilouise.com/order/ABC123",
}
Error:
{
"error":{
"message":"Failed to redeem order item"
}
}
Locking Orders
Due to the possibility of redeeming orders at multiple locations and/or outlets simultaneously, it is strongly recommended that all applications using the Shopping Cart API lock order before redeeming any part of them (to prevent race conditions/duplicate redemptions).
POST /cart/orders/ABC123 HTTP/1.1
Host: api.skilouise.com
locked=1&employeeID=43&locationID=76
In this example, order ABC123 is locked by employee 43 at location 76.
Note also that employee and location IDs are outlet-dependent.
If successful, and the order is not already locked, the following JSON-encoded result would be generated:
{
"code":"ABC123",
"url":"https://shop.skilouise.com/order/ABC123",
}
On failure, or if the order has already been locked, the result would be:
{
"error":{
"message":"Failed to lock order"
}
}
Applications that fail to acquire a lock on the order they are trying to redeem should not proceed with redemption until they are able to successfully acquire a lock on the order.
Unlocking Orders
Orders must be unlocked by the calling application once redemption has been completed.
POST /cart/orders/ABC123 HTTP/1.1
Host: api.skilouise.com
locked=0&employeeID=43&locationID=76
In this example, order ABC123 is unlocked by employee 43 at location 76.
If successful, the following JSON-encoded result would be generated:
{
"code":"ABC123",
"url":"https://shop.skilouise.com/order/BC123",
}
On failure, or if the order has been locked by a different employee, or from a different location, the result would be:
{
"error":{
"message":"Failed to unlock order"
}
}
Deleting
You can't delete an order using the Shopping Cart API.
HTTP Status Codes
The Shopping Cart API uses the following standard HTTP status codes:
200: OK
400: Bad Request
401: Unauthorized
503: Service Unavailable