API Input & Ouput
Communication with our API is currently supported in XML and JSON formats. When submitting a request, you are required to specify a data format as part of the URL, which represents both the format in which you are transmitting content in the body of the request (POST and PUT requests) and also the format in which you expect to receive output in the response body.
Providing Input
To create an “order status” using XML as the data format, you would make a HTTP POST request:
POST
https://www.mystore.com/restapi/orderstatuses.xml
<OrderStatus>
<Name>New Status</Name>
</OrderStatus>
To create the same “order status” using JSON as the data format, you would make an HTTP POST request:
POST
https://www.mystore.com/restapi/orderstatuses.json
{
"Name": "New Status"
}
Retrieving Output
To fetch a list of current “order statuses” using XML as the data format, you would make a HTTP GET request:
GET
https://www.mystore.com/restapi/orderstatuses.xml
<?xml version="1.0" encoding="utf-8"?>
<Results>
<OrderStatus ID="7">
<Name>Cancelled</Name>
</OrderStatus>
<OrderStatus ID="5">
<Name>Complete</Name>
</OrderStatus>
<OrderStatus ID="10">
<Name>Dispatched</Name>
</OrderStatus>
</Results>
To fetch the same list of “order statuses” using JSON as the data format, you would make an HTTP GET request:
GET
https://www.mystore.com/restapi/orderstatuses.json
[
{
"ID":7,
"Name":"Cancelled"
},
{
"ID":5,
"Name":"Complete"
},
{
"ID":10,
"Name":"Dispatched"
}
]