Introduction

Loorex.com provides free API, which is available for all registered members. At the moment only JSON format is supported.

All requests to JSON API should be sent to following URL: https://loorex.com/api/json

Common message request format

All API methods have common request structure. Other API methods help pages will reference only structure of {RequestParameters} object.

Example of general message request:

{
    "jsonrpc": "2.0",
    "id": {MessageId},
    "accessToken": "{AccessToken}",
    "method": "{Module}.{Method}",
    "params": {RequestParameters}
}
Variable Type Appearance Description
{MessageId} Integer Mandatory Can be simple incremental integer, which can be used to identify response.
{AccessToken} String Mandatory Can be created at API keys page of your profile. Please consider using different key for each new application.
{Module} String Mandatory API module. Like "exam", which is used to access all exam related methods.
{Method} String Mandatory API method. Like "examCreate", which is used to create exam.
{Method} String Mandatory API method. Like "examCreate", which is used to create exam.
Both "Module" and "Method" compose together Json method parameter and identify which API method will be accessed.
{RequestParameters} Object Mandatory Object of API method specific parameters. Please refer to each individual API method to get a list of parameters.

Common error message response format

All API methods have same error message response format. Other API methods help pages will NOT reference error messages structure and examples.

Error message response means that request was not completed, and errors should be corrected.

Example of error message response:

{
    "id": {MessageId},
    "errors": [{ErrorsArray}],
    "warnings": [{WarningsArray}],
    "jsonrpc": "2.0"
}
Variable Type Appearance Description
{MessageId} Integer Mandatory Copy of MessageId value from request.
{ErrorsArray} Array of strings Mandatory List of user friendly error messages.
{WarningsArray} Array of strings Optional List of user friendly warning messages.

Common successful message response format

All API methods have common response structure. Other API methods help pages will reference only structure of {ResponseParameters} object.

Example of successful message response:

{
    "id": {MessageId},
    "result": {ResponseParameters},
    "jsonrpc": "2.0"
}
Variable Type Appearance Description
{MessageId} Integer Mandatory Copy of MessageId value from request.
{ResponseParameters} Object Mandatory Object of API method specific response parameters. Please refer to each individual API method to get exact structure.

Example

Request to create new exam:

{
    "jsonrpc": "2.0",
    "accessToken": "AccessToken",
    "method": "exam.examCreate",
    "params": {
        "title": "Exam title",
        "category": "Category",
        "code": "Code"
    },
    "id": 3
}

Response:

{
    "id": 3,
    "result": {
        "test_id": 11111
    },
    "jsonrpc": "2.0"
}