Classifying your return codes
Be explicit about your service behavior and service return codes. REST is great but you need to understand the types of failures you can have. Some may be actual failures. Others may be successful service invocations with a failure to complete business operations because of business rules.
Document the meaning, ownership, and handling behavior of your Service return codes. Do not assume your partner teams and calling systems have any expectations or understanding beyond success and not-success.
Ask other teams, you call, for their Service return code documentation. Force them to document their expectations.
Create response categories. Determine the owner and expected behavior possibilities for each category for services you build. The following is a basic categorization.
Created 2016 Oct 04
Create response categories. Determine the owner and expected behavior possibilities for each category for services you build. The following is a basic categorization.
HTTP Code Category | Remediation Owner | Remediation |
---|---|---|
Success | Everyone | Application or none required |
Business Error | Business | Manual process or Application rule |
Technical Error | IT / Technology | Manual |
Embedded Redirect | IT / Technology | Application Library |
NACK / Retry | IT / Technology | Library and/or delayed retry mechanism |
Asynchronous Messaging.
You can create the same types of categories for message-driven systems. They can post return codes to reply/response queues or to event log capture streams.
Proposed Return Code Categories
Map each response code to one of the categories. Make your application return the correct code for each service it provides. Implement the correct behavior for each service it invokes. The following is a sample list of proposed HTTP return code categories.HTTP Code | Return Code Description | Default Contract Behavior |
---|---|---|
100 | Continue | Technical Error |
101 | Switching protocol | Technical Error |
200 | OK | Success |
201 | Created | Success |
202 | Accepted | Success |
203 | Non-Authorative Information | Success |
204 | No Content | Success |
205 | Reset | Success |
206 | Partial Content | Success |
207 | Partial Success | Business Error |
300 | Multiple Choices | Technical Error |
301 | Moved Permanently | Embedded Redirect |
302 | Found | Embedded Redirect |
303 | See Other | Embedded Redirect |
304 | Not Modified | Technical Error |
305 | Use Proxy | Technical Error |
306 | Unused | Technical Error |
307 | Temporary Redirect | Embedded Redirect |
308 | Permanent Redirect | Embedded Redirect |
400 | Bad Request | Business Error |
401 | Unauthorized | Technical Error |
402 | Payment Required | Technical Error |
403 | Forbidden | Technical Error |
404 | Not Found | Technical Error |
405 | Method Not Allowed | Technical Error |
406 | Not Acceptable | Technical Error |
407 | Proxy Auth Required | Technical Error |
408 | Request Timeout | Technical Error |
409 | Conflict | Technical Error |
410 | Gone | Technical Error |
411 | Length Required | Technical Error |
412 | Precondition Failed | Technical Error |
413 | Request Entity Too Large | Technical Error |
414 | Request-URI Too Long | Technical Error |
415 | Unsupported Media Type | Technical Error |
416 | Request Ranage Not Satisfyable | Technical Error |
417 | Expectation Failed | Technical Error |
500 | Internal Server Error | Nack / Retry |
501 | Not Implemented | Technical Error |
502 | Bad Gateway | Technical Error |
503 | Service Unavailable | Nack / Retry |
504 | Gateway Timeout | Nack / Retry |
505 | HTTP Version Not Supported | Technical Error |
N/A | Failed to Route | ? |
Related
* https://joe.blog.freemansoft.com/2016/10/classifying-your-return-codes.html* https://joe.blog.freemansoft.com/2016/10/success-and-failure-in-world-of-service.html
Created 2016 Oct 04
Comments
Post a Comment