I'm making some REST services, and as I'm implementing a GET request, I was debating about what I should do if there is no record there, for example /profile/1234
. Now, if you tried to use /profiles/1234
(note the s on profiles) it would definitely be a 404 code because that URL definitely isn't found. But when it comes to there just being no 1234
profile, I'm not sure what I should return. I don't want to return {}
because that might give the impression there is a record with no data. But if I return a 404 error code, how is the consumer of the API supposed to tell the difference between the two 404s?
How can I be a responsible API designer by communicating programmatically what the difference between a service that doesn't exist and a record that doesn't exist?