Order Update API Calling the Order Update API
The API follows the RESTful pattern. The HTTP verb to update an existing resource is PUT,
and per custom, the top-level key of the payload is the name of the resource type,
order
, like in the JSON example above. So given a file updated_order.json
like this
{
"order": {
"merchant": { "id": "yourMerchantName" },
"merchant_reference": { "order_ref_1": "ZXCV1234" },
...
...
}
you should be able to call the API with curl
like this:
$ SQPASS='yourAccountKey:yourAccountSecret'
$ curl -i -X PUT -u $SQPASS -k \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-binary @updated_order.json \
https://sandbox.sequrapi.com/merchants/yourMerchantName/orders/ZXCV1234
If everything went alright, you will get an HTTP Success code (200, 202 or 204). In the case of 204, there will be no content in the reply:
HTTP/1.1 204 No Content
Server: nginx/1.2.1
Date: Thu, 20 Nov 2014 17:05:04 GMT
Connection: keep-alive
Status: 204 No Content
In the case of 200 or 202, you will get a JSON reply. This is not yet defined, but you must make sure that you treat all these codes as a success.
Errors
If there are inconsistencies in the payload, the API returns a 409 error code and an explanation of the conflict.
{
"errors": ["Invalid data: In shipped_cart, items' total_with_tax add up to 5055 (200+295+-1500+6060) but order_total_with_tax is 5097. The diff is 42."]
}