Response¶
All requests will be replied to with a JSON or XML string containing the documented variables for each method.
All JSON responses will contain a dictionary with four keys while XML will contain four elements under the root.
Key |
Description |
---|---|
method |
A string containing the name of the method that was called. |
status |
A string containing one of ok, warn, fail. |
error |
A list of error strings, describing any errors if status is set to warn or fail. |
result |
A list of response numbers, strings or response dictionaries. |
stats |
A list of request stats contain timing info and some counters if applicable. All timing stats are in milliseconds. |
The contents of result will depend on the method called.
Examples for a color search call¶
JSON¶
{
"method": "color_search",
"status": "ok",
"error": [],
"result": [
{
"score": 100,
"filepath": "path/folder/match1.jpg"
},
{
"score": 65.7,
"filepath": "path/folder/match2.jpg"
}
],
"stats": {
"total_results": 2,
"total_filtered_results": 2,
"total_returned_results": 2,
"time_resize": 42.47,
"time_search": 100.88,
"time_total": 144.2
}
}
XML¶
<?xml version="1.0" encoding="UTF-8"?>
<data>
<method>color_search</method>
<status>ok</status>
<error/>
<result>
<item>
<filepath>path/folder/match1.jpg</filepath>
<score>100.0</score>
</item>
<item>
<filepath>path/folder/match2.jpg</filepath>
<score>65.7</score>
</item>
</result>
<stats>
<total_results>2</total_results>
<total_filtered_results>2</total_filtered_results>
<total_returned_results>2</total_returned_results>
<time_resize>42.47</time_resize>
<time_search>100.88</time_search>
<time_total>144.2</time_total>
</stats>
</data>