Sections
Orders
The orders API application requires website authentication.
The application allows to retrieve and manipulate information on orders.
Read a collection of orders
URL | GET @ http://{sitename}.ugal.com/api/v1/orders.xml |
---|---|
Filters |
?startId={integer} ?status={new|pending|processed|cancelled} ?payStatus={paid|notPaid|refunded} ?customer={name or email} |
Pagination | ?p={pageId} |
Returns a collection of orders (25 orders per page):
// Status: 200 OK <orders> <order> <id>131061</id> <name>Joe Shopper</name> <email>joe@shopper.com</email> <status>new</status> <paystatus>notPaid</paystatus> <link>http://sitename.ugal.com/api/v1/orders/131061.xml</link> </order> {...} </orders>
Notes:
- Only orders with orderId >= startId are returned.
- Filter multiple status with a comma separated list: ?status=new,pending
- Filter multiple payStatus with a comma separated list: ?payStatus=paid,refunded
Read an order
URL | GET @ http://{sitename}.ugal.com/api/v1/orders/{orderId}.xml |
---|
Returns a representation of the order:
// Status: 200 OK <?xml version="1.0" encoding="UTF-8"?> <order> <id>131061</id> <name>Joe Shopper</name> <email>joe@shopper.com</email> <phone>01.45.54.42.00</phone> <status>new</status> <paystatus>paid</paystatus> <payservice>ogone</payservice> <paymethod>visa</paymethod> <promocode></promocode> <comment>Congrats on the great products!</comment> <billto> <company>UGAL</company> <firstname>Joe</firstname> <lastname>Shopper</lastname> <address>212, rue La Fayette</address> <address2>Escalier C</address2> <city>Paris</city> <state></state> <zip>75010</zip> <country>fr</country> </billto> <shipto> <company>UGAL</company> <firstname>Joe</firstname> <lastname>Shopper</lastname> <address>212, rue La Fayette</address> <address2>Escalier C</address2> <city>Paris</city> <state></state> <zip>75010</zip> <country>fr</country> <instructions>Leave on front porch if not at home.</instructions> </shipto> <lines> <line> <id>1</id> <quantity>1</quantity> <item> <name>Alfa Romeo 2600 (alfa-red)</name> <reference>alfa-red</reference> <price> <pricelist>default</pricelist> <currency>eur</currency> <amount>7200.00</amount> <vat>1179.93</vat> <vatrate>0.1960</vatrate> </price> <link>http://sitename.ugal.com/api/v1/items/alfa-red.xml</link> </item> </line> </lines> <amount> <total> <currency>eur</currency> <amount>7450.00</amount> <vat>1220.90</vat> </total> <parts> <currency>eur</currency> <amount>7200.00</amount> <vat>1179.93</vat> </parts> <shipping> <currency>eur</currency> <amount>250.00</amount> <vat>40.97</vat> <vatrate>0.1960</vatrate> </shipping> <discount> <currency>eur</currency> <amount>0.00</amount> <vat>0.00</vat> </discount> </amount> <payments> <payment> <status>paid</status> <date>2015-07-18</date> <service>ogone</service> <method>visa</method> <reference>173648293</reference> <account>**4111 Joe Shopper</account> <amount> <currency>eur</currency> <amount>7450.00</amount> <fee>0.00</fee> </amount> <created-at>2010-10-03T14:28:54Z</created-at> </payment> </payments> <attachments> <attachment> <id>130376</id> <title>Your invoice #130904</title> <date>2015-07-20</date> <type>invoice</type> <provider>UGAL</provider> <format>url</format> <url>http://attach.ugal.net/invoices/4dccfc736363c150.pdf</url> <link>http://sitename.ugal.com/api/v1/orders/131061/attachments/130376.xml</link> </attachment> </attachments> <created-at>2015-07-18T14:28:54Z</created-at> <updated-at>2015-07-19T13:42:19Z</updated-at> </order>
Notes:
- The <state> element is populated only for addresses in the United States.
- For sales tax based shops, the <vat> elements are not present in the representation of the order and a <salestax> element is added in the <amount> section:
{...} <amount> {...} <salestax> <currency>usd</currency> <amount>745.00</amount> </salestax> </amount> {...}
Update an order
- The status and the payStatus properties can be updated.
- Send data in the request body only for the properties to be updated.
- Order attachments can be manipulated using the Order attachments API application.
URL | PUT @ http://{sitename}.ugal.com/api/v1/orders/{orderId}.xml |
---|---|
Body | <order> <status>processed</status> <paystatus>paid</paystatus> </order> |
Returns the updated representation of the order:
// Status: 200 OK <order> <id>131061</id> {...} </site>