0

I am writing api that expects a List of customer Id's and then proces that List by iterating each and every request, and then the response body will contains response of each and every ID as if it was an individual request.

Sample request = [1,2,3]
Sample response =
{

"1" :{
"responseCode":"200"
}
"2":{
"responseCode":"404"
"errorMessage":"Id not found"
}
"3":{
"responseCode":"200"
}
}

Now what can be response code of this API itself, what are different response code in following cases:

  1. Partial success as above example?
  2. What if some other error comes while executing this api?
  3. All request retuned error because of some problem, the response will have all id and corresponding error codes, but what can be response code of the api itself?will it be 200?

I think there can be only 2 response status for this api(apart from auth/throttling etc.)? 200,500

user124
  • 423
  • 2
  • 7
  • 26
  • Imho, 1 request will lead to 1 response. This is REST default. So if anything fails, all should fail. This leads to 200, maybe 404 (some id's not found) and 500 if all breaks down. – JustLudo Mar 01 '22 at 08:45
  • https://stackoverflow.com/questions/8472935/http-status-code-for-a-partial-successful-request – inf3rno Mar 03 '22 at 12:23
  • Does this answer your question? [HTTP status code for a partial successful request](https://stackoverflow.com/questions/8472935/http-status-code-for-a-partial-successful-request) – inf3rno Mar 03 '22 at 12:24

0 Answers0