Response Formats
XML
All responses are, by default, returned in a REST-friendly XML format unless a format
parameter is sent and its value is not rest
.
Successful Response
<rsp stat="ok">
<api_key>9bb013121e8f3650f350b622a1735442</api_key>
<foo>bar</foo>
<method>rtm.test.echo</method>
</rsp>
Failure Response
<rsp stat="fail">
<err code="112" msg="Method "rtm.test.ech" not found"/>
</rsp>
JSON
To retrieve API results as JSON, send a format
parameter with the value json
.
Optionally, a callback function can be specified with the parameter callback
.
Successful Response
{"rsp":{
"stat":"ok",
"api_key":"9bb013121e8f3650f350b622a1735442",
"foo":"bar",
"format":"json",
"method":"rtm.test.echo"
}
}
If a callback
parameter with value RTM.apiCallback
was sent, a result similar to the following will be emitted:
RTM.apiCallback(
{"rsp":
{
"stat":"ok",
"api_key":"9bb013121e8f3650f350b622a1735442",
"callback":"RTM.apiCallback",
"foo":"bar",
"format":"json",
"method":"rtm.test.echo"
}
}
)
Failure Response
{"rsp":{
"stat":"fail",
"err":{
"code":"112",
"msg":"Method \"rtm.test.ech\" not found"
}
}
}