I'm currently coding an API for a social network with the Slim Framework. My question is: What are the best practices when there are no rows to return in the json structure?
Lets say that this call /v1/get/movies returns 2 rows from the table movie names:
[
{"name": "Ghostbusters"},
{"name": "Indiana Jones"}
]
But, then I call /v1/get/books and there are no rows in that table. Should I just return an empty structure?
[
]
...or would it be better a message and an error code?
[
"errors": {
"message": "no matches found",
"code": 134
}
]
Which is a better practice? (the API will be used in iOS and Android apps) Thanks!
[{"name": "..."}, {"name":"..."}]
– Martin Wickman May 29 at 8:18