What status code is more appropriate for a case when relation is not existing?
For instance, /articles/1/comments/4, with this call you will get commentID 4 from articleID 1. But what if commentID 4 not exists in this relation, what should API returned, 404 or 200 ?
EDIT: Let me clarify what do I meant.
The thing is, you can interpret 404 like resource not exists from another point of view, for instance: /articles/1/builders/3. You don't have such route at all in your application! Your application does have handler for such url completely. But /articles/1/comments/4. You have such route in app, you have handler (controller). And yeah, I know that this url reflect relationship between comments and articles, and this is why it is tricky. Because comment with ID 4 might exists in your DB even if it does not belong to article. Then if you have such route in application you may say that from http protocol point of view you have such resource, but based on your application logic, you may say that such comment not belongs to specified article.
It should be 404 (of course). You requested for a particular resource with ID equal to 4 and did not find it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With