REST API: Is it really a bad practice to create custom HTTP response codes?

Bad practice when writing a RESTful API to use custom HTTP response codes, for example:

  • 417 - Password Not Provided
  • 418 - Database Error

API custom response codes

I see there is a list of standard HTTP response codes . However, looking at the Twitter API , it looks like Twitter is trying to return the standard HTTP response codes when they are available, but their own error codes when they cannot align the error with the standard HTTP response (correct me if I'm wrong).

What is the best practice for response codes (especially for errors) when creating a RESTful API? Any comments on the practice Twitter chose?

+4
2

, , ... .

REST , , HTTP .

. Twitters " ", , , - .

, . - , , - , 400 " - " ( ).

X00 , , . , , .

, . 404 " ". , .

+5

:

  • - , API . (, 306 301).
  • , , . , , .
  • x00, , .
  • , ( ) . . -, , , IETF ( ).

Twitter -.:)

+5

All Articles