{
    "variable": [
        {
            "id": "baseUrl",
            "key": "baseUrl",
            "type": "string",
            "name": "string",
            "value": "https:\/\/mlm.pimenko.com"
        }
    ],
    "info": {
        "name": "Moodle Licence Manager API Documentation",
        "_postman_id": "be8bb6be-e633-415d-b190-bba804c16d62",
        "description": "",
        "schema": "https:\/\/schema.getpostman.com\/json\/collection\/v2.1.0\/collection.json"
    },
    "item": [
        {
            "name": "Licences",
            "description": "",
            "item": [
                {
                    "name": "List all licences.",
                    "request": {
                        "url": {
                            "host": "{{baseUrl}}",
                            "path": "api\/licences",
                            "query": [],
                            "raw": "{{baseUrl}}\/api\/licences"
                        },
                        "method": "GET",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application\/json"
                            },
                            {
                                "key": "Accept",
                                "value": "application\/json"
                            }
                        ],
                        "body": null,
                        "description": "Retourne la liste de toutes les licences."
                    },
                    "response": [
                        {
                            "header": [],
                            "code": 200,
                            "body": "[\n  {\n    \"id\": 1,\n    \"product_id\": 2,\n    \"key\": \"ABC123\",\n    \"status\": \"active\",\n    \"expires_at\": \"2026-12-31T00:00:00.000000Z\",\n    \"licence_type_id\": 1\n  }\n]",
                            "name": ""
                        }
                    ]
                },
                {
                    "name": "Create a licence and its first site.",
                    "request": {
                        "url": {
                            "host": "{{baseUrl}}",
                            "path": "api\/licence\/create",
                            "query": [],
                            "raw": "{{baseUrl}}\/api\/licence\/create"
                        },
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application\/json"
                            },
                            {
                                "key": "Accept",
                                "value": "application\/json"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\"licence_type\":1,\"product_id\":2,\"url\":\"https:\\\/\\\/example.com\"}"
                        },
                        "description": "Cr\u00e9e une licence et associe un premier site."
                    },
                    "response": [
                        {
                            "header": [],
                            "code": 201,
                            "body": "{\n  \"licence\": {\n    \"id\": 4,\n    \"product_id\": 2,\n    \"key\": \"550E8400-E29B-41D4-A716-446655440000-2Q7x9VxvR3m9y5m1n8W4k1qQ9aXhY2Z0mJfP8cT1eUo\",\n    \"status\": \"active\",\n    \"expires_at\": \"2027-06-02T00:00:00.000000Z\",\n    \"licence_type_id\": 1\n  },\n  \"site\": {\n    \"id\": 10,\n    \"url\": \"https:\/\/example.com\"\n  }\n}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 422,
                            "body": "{\n  \"message\": \"The given data was invalid.\"\n}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 500,
                            "body": "{\n  \"error\": \"Internal error message\"\n}",
                            "name": ""
                        }
                    ]
                },
                {
                    "name": "Add a new site to an existing licence identified by key.",
                    "request": {
                        "url": {
                            "host": "{{baseUrl}}",
                            "path": "api\/licences\/:licence_key\/sites",
                            "query": [],
                            "raw": "{{baseUrl}}\/api\/licences\/:licence_key\/sites",
                            "variable": [
                                {
                                    "id": "licence_key",
                                    "key": "licence_key",
                                    "value": "550E8400-E29B-41D4-A716-446655440000-2Q7x9VxvR3m9y5m1n8W4k1qQ9aXhY2Z0mJfP8cT1eUo",
                                    "description": "Cl\u00e9 unique de la licence au format UUID-HASH."
                                }
                            ]
                        },
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application\/json"
                            },
                            {
                                "key": "Accept",
                                "value": "application\/json"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\"url\":\"https:\\\/\\\/example.com\"}"
                        },
                        "description": "Ajoute un site \u00e0 une licence existante identifi\u00e9e par sa cl\u00e9."
                    },
                    "response": [
                        {
                            "header": [],
                            "code": 201,
                            "body": "{\n  \"site\": {\n    \"id\": 11,\n     \"licence_id\": 4,\n    \"url\": \"https:\/\/example.com\"\n  }\n}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 422,
                            "body": "{\n  \"message\": \"Nombre maximal de sites atteint pour cette licence.\"\n}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 500,
                            "body": "{\n  \"error\": \"Internal error message\"\n}",
                            "name": ""
                        }
                    ]
                }
            ]
        },
        {
            "name": "LicencesTypes",
            "description": "",
            "item": [
                {
                    "name": "List all licence types",
                    "request": {
                        "url": {
                            "host": "{{baseUrl}}",
                            "path": "api\/licencestypes",
                            "query": [],
                            "raw": "{{baseUrl}}\/api\/licencestypes"
                        },
                        "method": "GET",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application\/json"
                            },
                            {
                                "key": "Accept",
                                "value": "application\/json"
                            }
                        ],
                        "body": null,
                        "description": "Retourne la liste de tous les types de licences."
                    },
                    "response": [
                        {
                            "header": [],
                            "code": 200,
                            "body": "[\n  {\n    \"id\": 1,\n    \"name\": \"Standard\",\n    \"max_sites\": 5,\n\n  }\n]",
                            "name": ""
                        }
                    ]
                }
            ]
        },
        {
            "name": "Products",
            "description": "",
            "item": [
                {
                    "name": "List all products",
                    "request": {
                        "url": {
                            "host": "{{baseUrl}}",
                            "path": "api\/products",
                            "query": [],
                            "raw": "{{baseUrl}}\/api\/products"
                        },
                        "method": "GET",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application\/json"
                            },
                            {
                                "key": "Accept",
                                "value": "application\/json"
                            }
                        ],
                        "body": null,
                        "description": "Retourne la liste de tous les produits."
                    },
                    "response": [
                        {
                            "header": [],
                            "code": 200,
                            "body": "[\n  {\n    \"id\": 1,\n    \"name\": \"Plugin Moodle 1\",\n     \"slug\": \"plugin-moodle-1\",\n     \"description\": \"Description du plugin Moodle 1\",\n     \"created_at\": \"2024-01-01T00:00:00.000000Z\",\n     \"updated_at\": \"2024-01-01T00:00:00.000000Z\"\n\n\n  }\n]",
                            "name": ""
                        }
                    ]
                }
            ]
        }
    ],
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "Authorization",
                "type": "string"
            }
        ]
    }
}