Use 204 status codes (and other codes) instead of 404s in the API
B
Ben Eisenberg
Nice to have since a 4xx code is supposed to indicate an error on the client's end. Tools like CloudWatch report this as an error. If a request is good but we don't have data to return, it is best to return a 204 (No Content) error code instead of a 404 (Not Found).
Same is true for Opt-outs. Out-outs in Retrieve API as 404 is confusing. Nice to have it's own unique code as 20x or 4xx for Opt-outs.
Further, a no-match with a Retrieve API due to filter_updated flag should have a different code than 404/204.
Currently, there is not way to distinguish between:
a) no such record in PDL system (a true no-match);
b) we have a match but not with your filter flags;
c) an opt-out (on retrieve)
d) a real HTTP 404 error.
**ADDITION on 1.26.24: We should also have:
+206 code for we have a match in our system but your required parameters caused a no-match.
+207 for Opted-Out
B
Ben Eisenberg
Merged in a post:
204 to replace 404 for no match
R
Rasa Vella
LB articulated that all 'successful responses' be a 2XX return all user error be a 4XX return and PDL errors a 5XX return.
This would reduce confusion to clients when calculated what credits were used and why. In particular if they use more than one API endpoint.
W
Wandering Bovid
This, from what I understand also brings us more closely aligned with the industry norms