Response Formats
The format of data you submit to an API method, or that you receive as the output of a method, is controlled by the format specifier provided at the end of the URL used in the request. We currently support XML and JSON formats, but may add others over time.
Transmitting or receiving data in either format is normally as simple as just changing the response format specifier at the end of the URL (before any querystring). For example /Categories.xml becomes /Categories.json. POST requests require a little bit more work: make sure the Content-Type header is set appropriately ("text/xml" for XML and "application/json" for JSON).
In the API Reference section of this site you can check the documentation for an individual method to find out the formats supported. In the method pattern you'll normally see the file format specified as .{fileFormat} - e.g. /Categories.{fileFormat}.
There are some differences between the formats:
- When posting an XML request, the elements within the payload MUST match the order the elements are specified in the documentation.
- JSON uses integers for enumeration values instead of names, for both requests and responses. For this reason, the documentation lists names and numbers for affected enumeration types. Note that names should still be used in query strings.
- XML dates are in RFC 3339 format and look like this: "2013-06-20T00:16:11.0475401Z" (the Z indicates the time-zone is UTC). JSON dates look like this: "\/Date(1371695375637)\/" (the numeric part is the number of milliseconds since 1 Jan 1970 12:00am UTC).
A note on Attribute Datetime Formats
The date format for individual Attributes is not coupled to the request format, so it is possible to have XML dates for JSON requests for Attributes and vs versa.