Skip to content

Loyalty Online API Implementation

API implementation principles


A web service implementing the Loyalty Online API is deployed at the partner's host and must be integrated with partner's CRM system according to Koshelek Developers documentation. For messaging, the standard RESTful model is used, the data is transmitted in JSON format via the HTTPS protocol:

Loyalty Online API_en

As the web service implementing the API is deployed at partner's host, the following data must be presented to Koshelek:

Parameter Description
host:port Address of the partner's host providing the API.
login:password Username and password to authorize API requests from Koshelek.

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 at the Authorization HTTP header.

Encoding Requirements

Both API requests and responses should use UTF-8 encoding.

API Responses Structure

1. Headers

Answers from the partner's side must contain the following header:

HTTP
Content-Type: application/json; charset=utf-8;

2. HTTP Codes

Answers from the partner's side must use the following HTTP codes:

Code Description
200 API request successfully processed.
422 An error occurred while processing the request.

3. Body

The response body from the partner must comply with the response requirements specified in the description of the corresponding request.

4. Errors

In case of error the partner's side must return a JSON object containing the error code and description.

Response example:

HTTP
HTTP/1.1 422 Unprocessable Entity
<headers>

{
 "code": "123",
 "description": "DBMS server unavailable"
}

Please note:

The API assumes that all "elementary" fields of JSON objects returned in responses have a string type, even if they contain values of other types (numeric, Boolean, etc.) See the example of returning a numerical error code above.