Reputation: 172
In web-API client made a get request with a parameter, to process something and get data from the file system. The parameter requested through the API a folder path. If API found that path, it is processing something on the resources inside and returning the processed content with Http-200 status code. This is perfect.
What if the folder exists and while processing some content missing in the path to process. Should API return Http-200 with empty content or Http-204 with/without response message?
Upvotes: 2
Views: 7647
Reputation: 171
It depends on how you view the situation and how you interpret the result:
you could use any of the above if you feel it is correct to do so, if a user tries to find an account via a GetAccount
function that accepts an account number as input and that account doesn't exist I would return a 400 bad request error as the account did not exist, but I would also return an error string with something like 'unrecognised account number'
Upvotes: 1