Introduction to the Open Loyalty REST API

This part of the documentation is about the RESTful JSON API for the Open Loyalty platform.

Note

To use this documentation, you should have some basic knowledge of REST APIs.

Get current version

To retrieve the current version of OpenLoyalty, you need to call the /api/ endpoint with the GET method.

Definition

GET /api/

Example

curl http://localhost:8181/api/ \
    -X "GET" \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \

Example Response

STATUS: 200 OK
{
    "name": "OpenLoyalty",
    "version": "4.2.0"
}

Health check endpoint

The OpenLoyalty API provides a special endpoint for checking application status. The endpoint verifies the status of critical services like database, Elasticsearch, etc. Calling the /api/healthcheck endpoint with the GET method returns 204 code when all services are working correctly. Oherwise, it returns 503 with details about the status of each service.

Definition

GET /api/healthcheck

Example

curl http://localhost:8181/api/healthcheck \
    -X "GET" \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \

Example Response

STATUS: 503 Unavailable
[
    {
        "name": "PostgreSQL",
        "status": "Problem",
        "message": "An exception occurred in driver: SQLSTATE[08006] [7] could not translate host name \"db\" to address: Name or service not known"
    },
    {
        "name": "Elasticsearch",
        "status": "OK"
    },
    {
        "name": "RabbitMQ",
        "status": "OK"
    }
]

Elasticsearch “Result window is too large”

The message simply means that you tried to show results located after the 10,000th position. 10,000 is a limit and can be found in the .env file.