-1

I've got an API that should return a single resource, but the method of specifying the resource is complex enough that shoehorning it into a GET request query string doesn't make sense, so instead we use a POST and have a representation of the query in the body.

Given the resource is just /resource/search, with no parameters, what should the response be if the specified resource is not found? If the result was an array, a 200 with an empty array body would be fine, and if the resource was specified in the URL then a 404 would make sense, but I'm not sure if the resource being specified in the body means a 400 or similar is correct?

GoatInTheMachine
  • 3,583
  • 3
  • 25
  • 35
  • Possible duplicate of [What is the proper REST response code for a valid request but an empty data?](https://stackoverflow.com/questions/11746894/what-is-the-proper-rest-response-code-for-a-valid-request-but-an-empty-data) – CodeCaster Mar 09 '18 at 10:46

1 Answers1

0

I think when he specified resource is not found then return 404, it mean data not found by specified of REST. When response status=200, body=[]||{} means that is found a empty value Good luck!

Suhosauge
  • 44
  • 2