这是indexloc提供的服务,不要输入任何密码
Skip to content
Tony Tam edited this page Nov 30, 2012 · 2 revisions

Error Declaration

The API Declaration should describe how the different errorResponses map to the business logic of the API. For instance, if a 404 is returned, it may be due to a variety of reasons--invalid resource, object cannot be found, invalid parameter, etc. While the HTTP response codes can be interpreted by the consumer correctly, often they are ambiguous and can benefit from some documentation.

The errorResponse object contains just two fields, as shown below:

"errorResponses":[
  {
    "code": 400,
    "reason": "Raised if a user supplies an invalid username format"
  },
  {
    "code": 404,
    "reason": "The user cannot be found"
  }
],

code. This is the HTTP response code which causes the error condition

reason. This is a text explanation of what will cause the error condition

Clone this wiki locally