Sites

List sites

List sites on a server.

GET /api/server/{id}/sites

Example request :

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

Example response :

{
    "data": [
        {
            "id": 1,
            "domain": "website.com",
            "test_domain": null,
            "wildcard": false,
            "aliases": null,
            "directory": "/www",
            "published": false,
            "user": "cloud",
            "status": "installed",
            "type": "laravel",
            "application": null,
            "repository": {
                "name": "vendor/project",
                "branch": "master",
                "status": "installed"
            },
            "deployment_script": null,
            "build_script": null,
            "activate_script": null,
            "atomic": true,
            "php_version": "8.1",
            "server_id": 1,
            "created_at": "2022-08-17T18:10:37.000000Z",
            "secure": false,
            "hook_url": "...",
            "last_deployment": {
                "id": 1,
                "type": "manual",
                "branch": "main",
                "commit": {
                    "hash": "1234",
                    "author": "Matthieu Mota",
                    "avatar": "https://avatars.githubusercontent.com/u/2427947?v=4",
                    "message": "Commit",
                    "url": "https://github.com/vendor/repository/commit/1234"
                },
                "output": "From github.com:vendor/repository\n * branch            main       -> FETCH_HEAD\nAlready up to date.",
                "status": "finished",
                "site_id": 1,
                "started_at": "2022-09-09T19:58:12.000000Z",
                "ended_at": "2022-09-09T19:58:31.000000Z"
            },
            "balancing_method": null,
            "tags": []
        }
    ],
    "links": {
        "first": "https://cloud.boxydev.com/api/server/1/sites?page=1",
        "last": "https://cloud.boxydev.com/api/server/1/sites?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://cloud.boxydev.com/api/server/1/sites",
        "per_page": 20,
        "to": 1,
        "total": 1
    }
}

Get site

Show a site.

GET /api/site/{id}

Example request :

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

Example response :

{
    "id": 1,
    "domain": "website.com",
    "test_domain": null,
    "wildcard": false,
    "aliases": null,
    "directory": "/www",
    "published": false,
    "user": "cloud",
    "status": "installed",
    "type": "laravel",
    "application": null,
    "repository": {
        "name": "vendor/project",
        "branch": "master",
        "status": "installed"
    },
    "deployment_script": null,
    "build_script": null,
    "activate_script": null,
    "atomic": true,
    "php_version": "8.1",
    "server_id": 1,
    "created_at": "2022-08-17T18:10:37.000000Z",
    "secure": false,
    "hook_url": "...",
    "last_deployment": {
        "id": 1,
        "type": "manual",
        "branch": "main",
        "commit": {
            "hash": "1234",
            "author": "Matthieu Mota",
            "avatar": "https://avatars.githubusercontent.com/u/2427947?v=4",
            "message": "Commit",
            "url": "https://github.com/vendor/repository/commit/1234"
        },
        "output": "From github.com:vendor/repository\n * branch            main       -> FETCH_HEAD\nAlready up to date.",
        "status": "finished",
        "site_id": 1,
        "started_at": "2022-09-09T19:58:12.000000Z",
        "ended_at": "2022-09-09T19:58:31.000000Z"
    },
    "balancing_method": null,
    "tags": []
}

Create site

Create a site.

POST /api/server/{id}/site

You can get web templates list here. You can manage all your web templates via API or on your account.

Parameters :

Parameter Description
domain The site domain.
wildcard Enable subdomain access on site (Optional).
aliases Other site domains (Optional).
directory Site directory public on web server (Optional).
type Application type: laravel, symfony or wordpress. If empty, site will be simple PHP/HTML.
user Server user who own site.
php_version PHP version: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 or 8.2.
web_template_id Web template ID (Optional).

Example request :

curl "https://cloud.boxydev.com/api/server/1/site" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "domain": "fiorella.com",
        "wildcard": false,
        "aliases": ["marina.com", "matthieu.com"],
        "directory": "/public",
        "type": "laravel",
        "user": "cloud",
        "php_version": "8.1",
        "web_template_id": 1
    }'

Example response :

{
    "id": 1,
    "domain": "fiorella.com",
    "test_domain": null,
    "wildcard": true,
    "aliases": ["marina.com", "matthieu.com"],
    "directory": "/public",
    "published": false,
    "user": "cloud",
    "status": "installed",
    "type": "laravel",
    "application": null,
    "repository": {
        "name": "vendor/project",
        "branch": "master",
        "status": "installed"
    },
    "deployment_script": null,
    "build_script": null,
    "activate_script": null,
    "atomic": true,
    "php_version": "8.1",
    "server_id": 1,
    "created_at": "2022-08-17T18:10:37.000000Z",
    "secure": false,
    "hook_url": "...",
    "last_deployment": {
        "id": 1,
        "type": "manual",
        "branch": "main",
        "commit": {
            "hash": "1234",
            "author": "Matthieu Mota",
            "avatar": "https://avatars.githubusercontent.com/u/2427947?v=4",
            "message": "Commit",
            "url": "https://github.com/vendor/repository/commit/1234"
        },
        "output": "From github.com:vendor/repository\n * branch            main       -> FETCH_HEAD\nAlready up to date.",
        "status": "finished",
        "site_id": 1,
        "started_at": "2022-09-09T19:58:12.000000Z",
        "ended_at": "2022-09-09T19:58:31.000000Z"
    },
    "balancing_method": null,
    "tags": []
}

Update site

Update a site.

PUT /api/site/{id}

Parameters :

Parameter Description
domain The site domain.
test_domain Enable test domain.
wildcard Enable subdomain access on site.
aliases Other site domains.
directory Site directory public on web server.
type Application type: laravel, symfony or wordpress. If empty, site will be simple PHP/HTML.
user Server user who own site.
php_version PHP version: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 or 8.2.

Example request :

curl -X PUT "https://cloud.boxydev.com/api/site/1" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "domain": "fiorella.com",
        "test_domain": true,
        "wildcard": true,
        "aliases": ["marina.com", "matthieu.com"],
        "directory": "/public",
        "type": "laravel",
        "user": "cloud",
        "php_version": "8.1"
    }'

Example response :

{
    "id": 1,
    "domain": "fiorella.com",
    "test_domain": "fiorella.cloud.boxydev.com",
    "wildcard": true,
    "aliases": ["marina.com", "matthieu.com"],
    "directory": "/public",
    "published": false,
    "user": "cloud",
    "status": "installed",
    "type": "laravel",
    "application": null,
    "repository": {
        "name": "vendor/project",
        "branch": "master",
        "status": "installed"
    },
    "deployment_script": null,
    "build_script": null,
    "activate_script": null,
    "atomic": true,
    "php_version": "8.1",
    "server_id": 1,
    "created_at": "2022-08-17T18:10:37.000000Z",
    "secure": false,
    "hook_url": "...",
    "last_deployment": {
        "id": 1,
        "type": "manual",
        "branch": "main",
        "commit": {
            "hash": "1234",
            "author": "Matthieu Mota",
            "avatar": "https://avatars.githubusercontent.com/u/2427947?v=4",
            "message": "Commit",
            "url": "https://github.com/vendor/repository/commit/1234"
        },
        "output": "From github.com:vendor/repository\n * branch            main       -> FETCH_HEAD\nAlready up to date.",
        "status": "finished",
        "site_id": 1,
        "started_at": "2022-09-09T19:58:12.000000Z",
        "ended_at": "2022-09-09T19:58:31.000000Z"
    },
    "balancing_method": null,
    "tags": []
}

List balancing

List balancing sites on a load balancer.

GET /api/site/{id}/balancing

Example request :

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

Example response :

[
    {
        "server_id": 1,
        "port": 80,
        "weight": 1,
        "backup": false,
        "down": false
    },
    {
        "server_id": 2,
        "port": 80,
        "weight": 1,
        "backup": false,
        "down": false
    }
]

Update balancing

Update balancing sites on a load balancer.

PUT /api/site/{id}/balancing

Parameters :

Parameter Description
balancing_method The balancing method: least_conn or ip_hash. Empty is round_robin.
servers.*.id The server to load balance.
servers.*.port The port on server to load balance (Optional).
servers.*.weight The priority when balancing to server (Optional).
servers.*.backup The server is a backup (Optional).
servers.*.down The server is disabled (Optional).

Example request :

curl -X PUT "https://cloud.boxydev.com/api/site/1/balancing" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "balancing_method": "ip_hash"
        "servers": [
            { "id": 1, "port": 80, "weight": 1, "backup": false, "down": false },
            { "id": 2, "port": 80, "weight": 1, "backup": false, "down": false }
        ]
    }'

List syncing

List syncing sites on a site.

GET /api/site/{id}/syncing

Example request :

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

Example response :

[
    {
        "id": 1,
        "domain": "website.com",
        "test_domain": null,
        "wildcard": false,
        "aliases": null,
        "directory": "/public",
        "published": false,
        "user": "cloud",
        "status": "installed",
        "type": "laravel",
        "application": null,
        "repository": {
            "name": "vendor/project",
            "branch": "master",
            "status": "installed"
        },
        "deployment_script": null,
        "build_script": null,
        "activate_script": null,
        "atomic": true,
        "php_version": "8.1",
        "server_id": 1,
        "created_at": "2022-09-10T06:00:57.000000Z",
        "secure": false,
        "hook_url": "...",
        "last_deployment": {
            "id": 1,
            "type": "manual",
            "branch": "main",
            "commit": {
                "hash": "1234",
                "author": "Matthieu Mota",
                "avatar": "https://avatars.githubusercontent.com/u/2427947?v=4",
                "message": "Commit",
                "url": "https://github.com/vendor/repository/commit/1234"
            },
            "output": "From github.com:vendor/repository\n * branch            main       -> FETCH_HEAD\nAlready up to date.",
            "status": "finished",
            "site_id": 1,
            "started_at": "2022-09-09T19:58:12.000000Z",
            "ended_at": "2022-09-09T19:58:31.000000Z"
        },
        "balancing_method": null,
        "tags": []
    }
]

Update syncing

Update syncing sites on a site.

PUT /api/site/{id}/syncing

Parameters :

Parameter Description
sites.* The sites to be syncing with site.

Example request :

curl -X PUT "https://cloud.boxydev.com/api/site/1/syncing" \
    -H "Authorization: Bearer {token}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
        "sites": [2, 3]
    }'

Delete site

Delete a site.

DELETE /api/site/{id}

Example request :

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