API:v1r1:output formats

From MixxHelp

Jump to: navigation, search

API Main

Contents

Output Formats

Overview

The Mixx API supports XML output for all services, while JSON is available for many of them. If no format preference is specified in the request, the output will by default be XML. Services which do not support JSON output are marked in their individual documentation. In general though, actions which require an authenticated user (which means they require the use of your shared secret) do not support JSON, while others do.

XML

The XML format is straightforward, and is based around the following skeleton:

<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok" api_version="v1r1">
<!-- Response body here -->
</rsp>

If the request was successful, the "stat" attribute will be "ok", otherwise it will be "fail". In the event of a failure, the body will contain an "err" element with a numeric "code" attribute and a string "msg" attribute, which serve to give further information about what went wrong.

JSON

In order to request a JSON response, pass the argument "format=json" as a request parameter. If you request JSON from an action that does not support it, the result will be an unrecoverable error. While requesting JSON output, you may also specify a "callback" parameter. If you do, we will wrap the data in a call to the function specified. For example, if you include "callback=callMePlease", the output will appear as such:

callMePlease({"stat":"ok", "api_version":"v1r1","data":{ /* your data will be in here */ })

If no callback is specified, the output will not be wrapped in any function call.

Personal tools