Reputation: 13315
I am implementing a REST API and i have a set_ftp_credentials request for example
POST api.domain.com/object/set_ftp_credentials
This request checks that the ftp credentials are good by trying to connect.
We had a discussion here whether we should return a HTTP response 200 and in the content
return the the request have failed and the reason.
Or we should return some other HTTP response code (40* response code).
What is considered the right way of doing this ?
And if not 200 then what do you think is the right response code ?
Upvotes: 0
Views: 8582
Reputation: 412
One approach would be to answer the following questions for yourself:
Now, return your expected response pay load with a 200 HTTP response code. Return client side error (400 class) or server side error (500 class) for the failures.
You might want to consider the following:
Upvotes: 2
Reputation: 750
I believe that 200 is an OK response and should only be sent when the request was successfully satisfied.
Upvotes: 3