NOTE: Used only in Distribution API. Order represents orders made by consumers in consumer facing applications. There is some difference in orders workflow for different offer types. For digital offers such as deals and gift cards the system returns vouchers as a result of order placement. Attributes: Data ExampleJSON { "id": "", "order_number ": "", "status ": "", "account_id ": "", "customer_name ": "", "purchased_at ": "", "shipping_address ": {" "address_line_2": "", "city": "", "state_code": "", "postal_code": "" } XML <order> <id></ id> <order_number></ order_number> <status></ status> <items> <item>OrderItem</item> ... </ items> <account_id></ account_id> <customer_name></ customer_name> <purchased_at></ purchased_at> <shipping_address> <address_line_1></address_line_1> <address_line_2></address_line_2> <city></city> <state_code></state_code> <postal_code></postal_code> </ shipping_address></order> ActionsPlace OrderPlacing new orders is most common Order object operation. For “deal” type offers the only required attributes for placing an order are valid customer name, unique order_number and offer_id/quantity combination for each order item.As a reply for “place order” request you’ll receive order object. It’ll also have vouchers section filled if you ordered “deal” type offers. Resource URI: /orders Sample URL: http://testapi.adility.com/distribution/beta/orders curl -k -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY: <your key>" 'http://testapi.adility.com/distribution/beta/orders' -d '{"order":{"order_number": "<order number>", "customer_name": "John Smith", "items": [{"offer_id": "<id string>", "quantity": 2}] } }' XML curl -k -X POST -H "Content-Type: application/xml" -H "Accept: application/xml" -H "X-ADILITY-API-KEY: <your key>" 'http://testapi.adility.com/distribution/beta/orders' -d '<?xml version="1.0" encoding="UTF-8" ?> <order> <order_number>myuniqueordernumber000</order_number> <customer_name>John Smith</customer_name> <items> <item> <offer_id>[valid offer id]</offer_id> <quantity>2</quantity> </item> </items> </order>' Get Order DetailsGetting order details. This operation is usually used for checking order status.Request type: GET Resource URI: /orders/<id> Sample URL: http://testapi.adility.com/distribution/beta/orders/<order id> JSON curl -k -X GET -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY: <your key>" 'http://testapi.adility.com/distribution/beta/orders/<order id>' XML curl -k -X GET -H "Content-Type: application/xml" -H "Accept: application/xml" -H "X-ADILITY-API-KEY: <your key>" 'http://testapi.adility.com/distribution/beta/orders/<order id>' Cancel OrderThis operation will cancel an order with all its vouchers. Technically order cancellation is just sending updated order status.Request type: PUT Resource URI: /orders/<id> Sample URL: http://testapi.adility.com/distribution/beta/orders/<id> JSON curl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY: <your key>" "http://testapi.adility.com/distribution/beta/orders/<order id>" -d '{"order": {"status": "cancelled"}}' XML curl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "X-ADILITY-API-KEY: <your key>" "http://testapi.adility.com/distribution/beta/orders/<order id>" -d '<?xml version="1.0" encoding="UTF-8" ?> <order> <status>cancelled</status> </order>' Related resources Offer, Voucher, Shipment |
8 API Reference > Resources >