Api Error No Results
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn
Search Error No Results
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags search error no results on kodi Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like search error no results genesis you, helping each other. Join them; it only takes a minute: Sign up What is the proper REST response code for a valid request but an empty data? up vote 52 down vote favorite 18 For example you
Search Error No Results Tv Addons
run a GET request for users/9 but there is no user with id #9. Which is the best response code? 200 OK 202 Accepted 204 No Content 400 Bad Request 404 Not Found api http rest share|improve this question asked Jul 31 '12 at 18:45 IMB 2,35272965 2 Hint: Did you find User 9? –Crisfole Jul 31 '12 at 18:47 6 Hint 2: So the user 9 was not found? –Tomasz Nurkiewicz Jul 31
Search Error No Results Won't Go Away
'12 at 18:49 4 @IMB who is saying 204? "No Content" indicates that the entity you're looking for exists, but has no representation. For example if blog with id 15 has no comments, and you didn't want to return an empty list for blog number 15's comments: "/blog/15/comments" would return NoContent. On the other hand if blog 15 does exists, '404 Not Found' is more appropriate. –Crisfole Jul 31 '12 at 19:50 3 @Crisfole didn't you mean ". On the other hand if blog 15 does not exists, '404 Not Found' is more appropriate" –gdoron Dec 7 '15 at 9:02 4 I most certainly did @gdoron! :) Thanks. Sadly I'm approximately three years too late to edit that and fix. –Crisfole Dec 7 '15 at 17:25 | show 4 more comments 5 Answers 5 active oldest votes up vote 58 down vote accepted TL;DR: Use 404 See This Blog. It explains it very well. Summary of the blog's comments on 204: 204 No Content is not terribly useful as a response code for a browser (although according to the HTTP spec browsers do need to understand it as a 'don't change the view' response code). 204 No Content is however, very useful for ajax web services which may want to indicate success without having to return something. (Especially in cases like DEL
from GoogleSign inHidden fieldsSearch for groups or messages
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site http://programmers.stackexchange.com/questions/199742/restful-api-design-what-should-i-return-if-there-are-no-rows About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Programmers Questions Tags Users Badges Unanswered Ask Question _ Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute: Sign up Here's how it works: Anybody can error no ask a question Anybody can answer The best answers are voted up and rise to the top RESTful API design. What should I return if there are no rows? up vote 40 down vote favorite 11 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 error no results 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! programming-practices rest api-design json share|improve this question edited May 30 '13 at 2:35 asked May 29 '13 at 6:09 andufo 303137 3 To me this feels like the question whether zero is actually an amount. –scarfridge May 29 '13 at 8:14 15 Your example is broken. You can't have a json objects with duplicate keys. What you are looking for is an array, ie [{"name": "..."}, {"name":"..."}] –Martin Wickman May 29 '13 at 8:18 @MartinWickman Sorry for that, i just fixed it. –andufo May 29 '13 at 14:03 8 @andufo, actually, you didn't... –avakar May 29 '13 at