Connection to API
Connection requirements
Interaction model
The API uses the RESTful model, all the data are transferred as JSON objects.
Connection Parameters
The API is provided by the Koshelek host. The following request parameters are provided for a partner in order to get access:
| Parameter | Description |
|---|---|
| host:port | Address and port of Koshelek host providing the API. |
| login:password | Username and password for API request authorization. |
API Requests Authorization
The HTTPS protocol is used. HTTP Basic Authentication (RFC 7617) mechanism should be used for API requests authorization. Credentials for authorization are transferred in the Authorization HTTP header.
Request Structure And Format
All API requests expect the following in the request header:
Content-type ="application/json;charset=utf-8"
Image Format
Allowed format for images involved in API exchange: PNG or JPG. For image resolution requirements, refer to API requests documentation.
HTTP Response Codes
If the request has been successfully processed, the Koshelek host returns an HTTP response containing the status code 200, and the body with a payload described in the request documentation.
| HTTP code | Description |
|---|---|
| 200 | API request is successfully processed. |
If an error occurred during the request processing, the host will return an HTTP response containing a status code from the table below and the error description as a JSON object:
| HTTP Code | Description |
|---|---|
| 400 Bad Request | Invalid request format/structure. |
| 401 Unauthorized | Request authorization error. |
| 403 Forbidden | Request authentication error (lack of rights to perform the request). |
| 422 Unprocessable Entity | Business scenario processing error. |
| 500 Internal Server Error | Problems on Koshelek server. |
Error body
For any of the aforementioned 4XX error codes, the response body contains a JSON object with fields code and details:
Content-Type: application/json
{
"code": string, //Error code. Does not match HTTP status code. Human readable message in UPPER_SNAKE_CASE.
"details": string //Error description in English. Not intended for display in UI.
}
Info
Refer to API response documentation to review description of possible validation or business scenario processing errors.