Scripts

List scripts

List all your scripts.

GET /api/scripts

Example request :

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

Example response :

{
    "data": [
        {
            "id": 1,
            "name": "fiofio",
            "as_user": "cloud",
            "content": "echo Fiorella",
            "created_at": "2022-08-23T16:54:12.000000Z"
        }
    ],
    "links": {
        "first": "https://cloud.boxydev.com/api/scripts?page=1",
        "last": "https://cloud.boxydev.com/api/scripts?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://cloud.boxydev.com/api/scripts",
        "per_page": 20,
        "to": 1,
        "total": 1
    }
}

Get script

Show script.

GET /api/script/{id}

Example request :

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

Example response :

{
    "id": 1,
    "name": "fiofio",
    "as_user": "cloud",
    "content": "echo Fiorella",
    "created_at": "2022-08-23T16:54:12.000000Z"
}

Create script

Create a script.

POST /api/script

Parameters :

Parameter Description
name The script name.
as_user The user who runs script.
content The script content.

Example request :

curl "https://cloud.boxydev.com/api/script" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "name": "fiofio",
        "as_user": "cloud",
        "content": "script"
    }'

Example response :

{
    "id": 1,
    "name": "fiofio",
    "as_user": "cloud",
    "content": "script",
    "created_at": "2022-09-01T20:08:26.000000Z"
}

Update script

Update a script.

PUT /api/script/{id}

Parameters :

Parameter Description
name The script name.
as_user The user who runs script.
content The script content.

Example request :

curl -X PUT "https://cloud.boxydev.com/api/script/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "name": "marina",
        "as_user": "cloud",
        "content": "script"
    }'

Example response :

{
    "id": 1,
    "name": "marina",
    "as_user": "cloud",
    "content": "script",
    "created_at": "2022-09-01T20:08:26.000000Z"
}

Run script

Run a script.

POST /api/script/{id}/run

Parameters :

Parameter Description
servers Servers ID where to run script.

Example request :

curl -X POST "https://cloud.boxydev.com/api/script/1/run" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "servers": [1, 2]
    }'

Delete script

Delete a script.

DELETE /api/script/{id}

Example request :

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