Responses¶
The optional parameter ResponseType
is used to specifiy a response format. There are currently 2 valid response types:
JSON Response Format (default)¶
JSON, or JavaScript Object Notation, is a simple machine-readable data-interchange format, which makes constructing API applications in JavaScript easy (though it can be used from other languages too!).
To return an API response in JSON format, send a parameter ResponseType
in the request with a value of “JSON”.
A method call returns something like this:
{"Title":{"id":"12345","title":"My Document","created":"2010-12-20 13:10:11"}}
If an error occurs, the following is returned:
{"Error":{"Code":"error-code","Description":"error-description"}}
Since JSON is the default response format, if you don’t pass in any value for ResponseType
you’ll still get a JSON response.
XML Response Format¶
XML is a more readable response format to use and will return a simple XML block.
To return the response in XML format, send a parameter ResponseType
in the request with a value of “XML”.
A method call returns this:
<?xml version="1.0" encoding="utf-8"?>
<Response>
[xml-payload-here]
</Response>
If an error occurs, the following is returned:
<?xml version="1.0" encoding="utf-8"?>
<Response>
<Code>[error-code]</Code>
<Description>[error-description]</Description>
</Response>
Since XML is more readable, it will be used throughout the documentation for example payload responses.