A
A
alex maslakoff2017-04-14 11:07:49
JSON
alex maslakoff, 2017-04-14 11:07:49

What is the best way to return successful requests and errors in REST API?

How are the latest fashion trends about what response format should be in a REST API? I know there is no standard. For example, is it worth returning "code: 422 / http code 200", or is it better to return it only as http 422 and return arrays of errors in json? And in general, in general, how is it generally better to return successful requests and errors? How are you doing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2017-04-14
@sergey-gornostaev

How is this not a standard? There is. If successful, return code 200 in the header and in the data body in the format that the client expects. In case of an error, the error code and text of the error message.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question