Errors
The API uses standard HTTP status codes. 2xx means success, 4xx means a problem with the request, and 5xx means something failed at Place2Book.
Status codes
| Status | Meaning |
|---|---|
200 OK
|
The request succeeded. |
201 Created
|
The resource was created. Its URL is in the Location header. |
204 No Content
|
The resource was deleted. The response has no body. |
400 Bad Request
|
A required parameter is missing or has the wrong format. |
401 Unauthorized
|
The API token is missing, unknown or deactivated. See Authentication. |
403 Forbidden
|
The action is not allowed in the resource’s current state, e.g. deleting an event that has sales. |
404 Not Found
|
The resource does not exist, or your token cannot access it. |
415 Unsupported Media Type
|
The Accept header doesn’t ask for application/vnd.place2book.v1+json. |
422 Unprocessable Content
|
Validation failed. The body lists what to fix. |
424 Failed Dependency
|
The resource cannot be deleted because other records depend on it. |
500 Internal Server Error
|
Something went wrong at Place2Book. We are notified automatically. Contact us if it persists. |
Error body
Most errors return a JSON object with a single message:
Response404 Not Found
{
"message": "No event found with id: 12345678"
}Validation errors
When a create or update fails validation, the response is 422 Unprocessable Content. The body has one key per error, numbered from error_1:
Response422 Unprocessable Content
{
"error_1": "Name can't be blank",
"error_2": "Cvr is the wrong length (should be 8 characters)"
}Error messages may change Error messages are meant for people. Don’t parse their text. Branch on the HTTP status instead, and log or show the messages.