The Australian Government coat of Arms

Communities of practice

Communities of practice

HTTP Status Response code 200 OK or 404 Not found for a requested resource not available in backend system

Hello All,

I have a query
as we know GET:/api/customers when executed and returns empty array we return 200 OK Success with [] (an empty array)

for GET: /api/customers/{customer_id} where customer_id=12345 and assume 12345 is not existing in the database or backend system what possible HTTP Status response code shall be returned 200 OK or 404 Not Found

going through this link
I can say I must use 404 Not Found for the GET: /api/customers/12345 but I received mixed suggestions of using 200 OK in case customer_id=12345 does no exist in database or backend system and use 404 Not Found ONLY when the requested resource URI is not defined in the REST API definition file the interface.

Appreciate your help on this.