Error handling
The user is informed about errors by the HTTP status code.
| HTTP code | Meaning |
|---|---|
| 200 OK | The operation was completed successfully. |
| 201 Created | The record was created successfully. |
| 400 Bad Request | Bad request. Usually occurs with a PUT/POST operation that failed (e.g. you refer to an object that does not meet the required parameters, or does not exist). It is also returned for an invalid value of a URL parameter (e.g. dry-run, period and from in the ad statistics, or limit in the ad table); the message then lists the allowed values of the parameter. |
| 401 Unauthorized | This operation requires login. |
| 402 Payment Required | The user does not have the permissions required for this operation (e.g. no WRITE permission, the dealer is suspended, the ad is not allowed in this export, etc.). |
| 403 Forbidden | Incorrect login or problems with login operations. |
| 404 Not Found | Record not found. This may concern an agenda or a specific record (e.g. because it was deleted). |
| 405 Method Not Allowed | The specified HTTP method is not allowed. |
| 406 Not Acceptable | The request was not accepted. This may indicate an error in the structure of the input data, or in other variables of the request (e.g. filter, xpath etc.)It is also returned for a URL parameter that the agenda does not support and that would change the content of the response (e.g. limit in the ad statistics, even with the value 0), and for a query that is too demanding for the server – the message says how to make it smaller.In the ad table it is also returned for the parameter section, breakdown, fulltext, ftx-loc or usrval-show, and for order or filter on a column that the chosen detail level does not output, on a metric that was not measured in the chosen range (the message says since when it is measured), or on a metric that does not arise in the section or the chosen placements. |
| 410 Gone | The ad (agendas moto, dily, prislusenstvi) has been deleted. |
| 500 Internal Server Error | An error occurred on our server with the specific request. It is probably an error in the application. The error has been logged and we deal with such errors; in any case, if you have a problem, contact us to speed up the solution. |
| 503 Service Unavailable | An error occurred on our server and the service as a whole is currently unavailable. |
Unless it is a 5xx error, an error response usually also includes a description in the same format as validation messages.
Example of an error response:
<tipmoto>
<chyby>
<chyba>An unknown error occurred while saving.</chyba>
</chyby>
</tipmoto>
Because some clients have trouble processing HTTP errors (e.g. some libraries treat 4xx errors as a bad request and do not process it further), 4xx error codes can be suppressed with ?no-http-errors=true - for more see parameters in the URL
For the same reason, error messages can be added to the output format using ?code-in-response=true
Likewise - when an ad is created, the Location header with the location of the new ad is sent. This can be suppressed using ?no-http-location=true
