Authentications

List authentications

List authentications on a site.

GET /api/site/{id}/authentications

Example request :

curl "https://cloud.boxydev.com/api/site/1/authentications" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json"

Example response :

{
    "data": [
        {
            "id": 1,
            "name": "Authentication Area",
            "path": "/",
            "status": "installed",
            "created_at": "2022-09-13T19:55:24.000000Z",
            "users": [
                {
                    "id": 1,
                    "username": "marina",
                    "created_at": "2022-09-13T19:55:24.000000Z"
                },
                {
                    "id": 2,
                    "username": "fiorella",
                    "created_at": "2022-09-13T19:55:24.000000Z"
                }
            ]
        }
    ],
    "links": {
        "first": "https://cloud.boxydev.com/api/site/1/authentications?page=1",
        "last": "https://cloud.boxydev.com/api/site/1/authentications?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://cloud.boxydev.com/api/site/1/authentications",
        "per_page": 20,
        "to": 1,
        "total": 1
    }
}

Get authentication

Show an authentication.

GET /api/site-authentication/{id}

Example request :

curl "https://cloud.boxydev.com/api/site-authentication/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json"

Example response :

{
    "id": 1,
    "name": "Authentication Area",
    "path": "/",
    "status": "installed",
    "created_at": "2022-09-13T19:55:24.000000Z",
    "users": [
        {
            "id": 1,
            "username": "matthieu",
            "created_at": "2022-09-13T19:55:24.000000Z"
        },
        {
            "id": 2,
            "username": "fiorella",
            "created_at": "2022-09-13T19:55:24.000000Z"
        }
    ]
}

Create authentication

Create an authentication.

POST /api/site/{id}/authentication

Parameters :

Parameter Description
name The authentication name.
path Path can be empty to protect all site or you can protect a specific route.
users.*.username The username who can access to website.
users.*.password The password for user.

Example request :

curl "https://cloud.boxydev.com/api/site/1/authentication" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "name": "Authentication Area",
        "users": [
            { "username": "fiorella", "password": "password" },
            { "username": "marina", "password": "password" }
        ]
    }'

Example response :

{
    "id": 1,
    "name": "Authentication Area",
    "path": "/",
    "status": "installing",
    "created_at": "2022-09-13T20:17:31.000000Z",
    "users": [
        {
            "id": 1,
            "username": "fiorella",
            "created_at": "2022-09-13T20:17:31.000000Z"
        },
        {
            "id": 2,
            "username": "marina",
            "created_at": "2022-09-13T20:17:31.000000Z"
        }
    ]
}

Delete authentication

Delete an authentication.

DELETE /api/site-authentication/{id}

Example request :

curl -X DELETE "https://cloud.boxydev.com/api/site-authentication/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json"