<< Back to API Docs
HTTP Response Formats
Each HTTP Response exposes a representation of a Meaningtool Result.
The representation of this Result is formatted as requested and sent back to the client along with the corresponding HTTP Status Code and HTTP Response Headers.
JSON Representation
The Content-Type HTTP Response Header for a JSON formated Response will be: application/json.
Example HTTP Response body:
{
"status": "ok",
"code": "0",
"message": "Categories retrieved.",
"payload": {
"categories": [
{ "score": 0.75, "name": "Nature" },
{ "score": 0.5, "name": "Human body" },
{ "score": 0.40000000000000002, "name": "Physics" }
],
}
}
JavaScript Representation
The Content-Type HTTP Response Header for a JavaScript formated Response will be: text/javascript.
Example HTTP Response body when HTTP Request argument callback=foo:
foo({
"status": "ok",
"code": "0",
"message": "Categories retrieved.",
"payload": {
"categories": [
{ "score": 0.75, "name": "Nature" },
{ "score": 0.5, "name": "Human body" },
{ "score": 0.40000000000000002, "name": "Physics" }
],
}
});
XML Representation
The Content-Type HTTP Response Header for a XML formated Response will be: application/xml.
Example HTTP Response body:
<?xml version="1.0" encoding="UTF-8"?>
<resource>
<status>ok</status>
<code>0</code>
<message>Categories retrieved.</message>
<payload>
<categories>
<category>
<score>0.75</score>
<name>Nature</name>
</category>
<category>
<score>0.5</score>
<name>Human body</name>
</category>
<category>
<score>0.40000000000000002</score>
<name>Physics</name>
</category>
</categories>
</payload>
</resource>