alpaca icon indicating copy to clipboard operation
alpaca copied to clipboard

Support custom error/status code in response body

Open matrixik opened this issue 10 years ago • 0 comments

Some APIs return status of response in body. And some badly designed APIs return always HTTP 200 and real status code in body.

bit.ly: http://dev.bitly.com/formats.html

HTTP Response Status Code is 200 on all valid response in json and xml formats. In json and xml responses, the status_code and status_txt values indicate whether a request is well formed and valid.

  • json { "status_code": 200, "status_txt": "OK", "data" : ... }
  • json { "status_code": 403, "status_txt": "RATE_LIMIT_EXCEEDED", "data" : null }

ArangoDB: https://www.arangodb.org/manuals/current/HttpDatabase.html Return codes

  • HTTP 201 - is returned if the database was created successfully.
  • HTTP 400 - is returned if the request parameters are invalid or if a database with the specified name already exists.
  • HTTP 403 - is returned if the request was not executed in the _system database.
  • HTTP 409 - is returned if a database with the specified name already exists.

{ "result" : true, "error" : false, "code" : 201 }

Would be nice if we could add code in body names to api.json.

matrixik avatar May 04 '14 10:05 matrixik