I am trying to make the sorta API loosly based on ApiExchangeExchange results.
So here is my json output.
{
"items" : [ ... objects in here .... ]
"page" :
"page_size" :
"total_pages" :
"total_items_count" :
"maximum_quota" :
"remaining_quota" :
}
pretty damn simple.
Now I'm not sure what to do if a person tries to request a product .. a question or question or something else, and the item does not exist.
eg..
{
"items": []
... snipped ....
}
I thought I would return 200 and Json above, with the Items property being empty.
Another idea that I had was to return json with the items empty BUT property, setting the HTTP status of the response to 404.
Thoughts / standards?
I really want to return json, no matter what. What for? quotas. Even an empty result is still a legitimate hit for the api service.
source
share