MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile). You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Generate API token.

Licences

List all licences.

requires authentication

Retourne la liste de toutes les licences.

Example request:
curl --request GET \
    --get "https://mlm.pimenko.com/api/licences" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://mlm.pimenko.com/api/licences"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://mlm.pimenko.com/api/licences';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


[
    {
        "id": 1,
        "product_id": 2,
        "key": "ABC123",
        "status": "active",
        "expires_at": "2026-12-31T00:00:00.000000Z",
        "licence_type_id": 1
    }
]
 

Request      

GET api/licences

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Create a licence and its first site.

requires authentication

Crée une licence et associe un premier site.

Example request:
curl --request POST \
    "https://mlm.pimenko.com/api/licence/create" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"licence_type\": 1,
    \"product_id\": 2,
    \"url\": \"https:\\/\\/example.com\"
}"
const url = new URL(
    "https://mlm.pimenko.com/api/licence/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "licence_type": 1,
    "product_id": 2,
    "url": "https:\/\/example.com"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://mlm.pimenko.com/api/licence/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'licence_type' => 1,
            'product_id' => 2,
            'url' => 'https://example.com',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "licence": {
        "id": 4,
        "product_id": 2,
        "key": "550E8400-E29B-41D4-A716-446655440000-2Q7x9VxvR3m9y5m1n8W4k1qQ9aXhY2Z0mJfP8cT1eUo",
        "status": "active",
        "expires_at": "2027-06-02T00:00:00.000000Z",
        "licence_type_id": 1
    },
    "site": {
        "id": 10,
        "url": "https://example.com"
    }
}
 

Example response (422):


{
    "message": "The given data was invalid."
}
 

Example response (500):


{
    "error": "Internal error message"
}
 

Request      

POST api/licence/create

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

licence_type   integer     

ID du type de licence. Example: 1

product_id   integer     

ID du produit. Example: 2

url   string     

URL du site à associer. Example: https://example.com

Add a new site to an existing licence identified by key.

requires authentication

Ajoute un site à une licence existante identifiée par sa clé.

Example request:
curl --request POST \
    "https://mlm.pimenko.com/api/licences/550E8400-E29B-41D4-A716-446655440000-2Q7x9VxvR3m9y5m1n8W4k1qQ9aXhY2Z0mJfP8cT1eUo/sites" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"url\": \"https:\\/\\/example.com\"
}"
const url = new URL(
    "https://mlm.pimenko.com/api/licences/550E8400-E29B-41D4-A716-446655440000-2Q7x9VxvR3m9y5m1n8W4k1qQ9aXhY2Z0mJfP8cT1eUo/sites"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "url": "https:\/\/example.com"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://mlm.pimenko.com/api/licences/550E8400-E29B-41D4-A716-446655440000-2Q7x9VxvR3m9y5m1n8W4k1qQ9aXhY2Z0mJfP8cT1eUo/sites';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'url' => 'https://example.com',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "site": {
        "id": 11,
        "licence_id": 4,
        "url": "https://example.com"
    }
}
 

Example response (422):


{
    "message": "Nombre maximal de sites atteint pour cette licence."
}
 

Example response (500):


{
    "error": "Internal error message"
}
 

Request      

POST api/licences/{licence_key}/sites

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

licence_key   string     

Clé unique de la licence au format UUID-HASH. Example: 550E8400-E29B-41D4-A716-446655440000-2Q7x9VxvR3m9y5m1n8W4k1qQ9aXhY2Z0mJfP8cT1eUo

Body Parameters

url   string     

URL du site à associer à la licence. Example: https://example.com

LicencesTypes

List all licence types

requires authentication

Retourne la liste de tous les types de licences.

Example request:
curl --request GET \
    --get "https://mlm.pimenko.com/api/licencestypes" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://mlm.pimenko.com/api/licencestypes"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://mlm.pimenko.com/api/licencestypes';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


[
  {
    "id": 1,
    "name": "Standard",
    "max_sites": 5,

  }
]
 

Request      

GET api/licencestypes

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Products

List all products

requires authentication

Retourne la liste de tous les produits.

Example request:
curl --request GET \
    --get "https://mlm.pimenko.com/api/products" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://mlm.pimenko.com/api/products"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://mlm.pimenko.com/api/products';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


[
    {
        "id": 1,
        "name": "Plugin Moodle 1",
        "slug": "plugin-moodle-1",
        "description": "Description du plugin Moodle 1",
        "created_at": "2024-01-01T00:00:00.000000Z",
        "updated_at": "2024-01-01T00:00:00.000000Z"
    }
]
 

Request      

GET api/products

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json