4

Error Response PHP >= 5.3

exception http status validation

API methods can make use of RestException class to provide error information to the user.

use throw new RestException($httpStatusCode) to send the error response to the client.

For the list of HTTP Status codes and their meaning take a look at Wikipedia

This API Server is made using the following php files/folders

This API Server exposes the following URIs

GET currency/format ⇠ Currency::format()

Try the following links in your browser

GET currency/format

{
  "error": {
    "code": 400,
    "message": "Bad Request"
  }
}
GET currency/format?number=not_a_number
{
  "error": {
    "code": 400,
    "message": "Bad Request: not a valid number"
  }
}
GET currency/format?number=55

"USD55.00"