Sites

List sites

List all the sites for a specific server

GET api/servers/{server}/sites

Example request:

curl -X GET "https://ploi.io/api/servers/{server}/sites" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": [
        {
            "id": 137,
            "domain": "ploi.com",
            "web_directory": "/public",
            "wordpress": false,
            "laravel": false,
            "project_root": "/",
            "last_deploy_at": "2018-10-29 13:30:58",
            "created_at": "2018-10-29 14:30:41"
        },
        {
            "id": 138,
            "domain": "is.com",
            "web_directory": "/public",
            "wordpress": false,
            "laravel": false,
            "project_root": "/",
            "last_deploy_at": "2018-10-31 10:04:12",
            "created_at": "2018-10-31 11:02:26"
        },
        {
            "id": 139,
            "domain": "awesome.com",
            "web_directory": "/public",
            "wordpress": false,
            "laravel": false,
            "project_root": "/",
            "last_deploy_at": null,
            "created_at": "2018-11-01 09:53:54"
        }
    ]
}

Create site

Create a site in your server

POST api/servers/{server}/sites

Parameters

Parameter Type Status Description
root_domain string required Maximum: 100
web_directory string required Maximum: 50 Must match this regular expression: /[a-zA-Z0-9\/]/
project_root string optional Maximum: 50 Must match this regular expression: /[a-zA-Z0-9\/]/

Example request:

curl -X POST "https://ploi.io/api/servers/{server}/sites/{site}/repository" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
   --data '{"root_domain":"domain.com", "web_directory":"/public"}'

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": 90,
        "domain": "domain.com",
        "web_directory": "/public",
        "wordpress": false,
        "laravel": false,
        "project_root": "/",
        "last_deploy_at": "2018-09-14 20:43:11",
        "created_at": "2018-09-14 11:40:01"
    }
}

Show site

Show a single site in a server

GET api/servers/{server}/sites/{id}

Example request:

curl -X GET "https://ploi.io/api/servers/{server}/sites/{id}" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": 90,
        "domain": "domain.com",
        "web_directory": "/public",
        "wordpress": false,
        "laravel": false,
        "project_root": "/",
        "last_deploy_at": "2018-09-14 20:43:11",
        "created_at": "2018-09-14 11:40:01"
    }
}

Delete site

Delete a site

DELETE api/servers/{server}/sites/{id}

Example request:

curl -X DELETE "https://ploi.io/api/servers/{server}/sites/{id}" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"

Log site

Get latest deploy log from a site

GET api/servers/{server}/sites/{id}/log

Example request:

curl -X GET "https://ploi.io/api/servers/{server}/sites/{id}/log" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"

Example response:

{
    "data": {
        "description": "Clone git repository username/repository",
        "content": "Cloning into '/home/ploi/domain.com'...\n.env.example found, copying to .env..\n",
        "site_id": 90,
        "server_id": 58,
        "created_at": "2018-09-14 22:43:11"
    }
}