Ploi API
Ploi API

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\/]/
project_type string optional Set's the site's project type, available options: laravel, nodejs, statamic, craft-cms, symfony, wordpress, octobercms, cakephp
system_user string optional Must be a string matching the name of a system user in your server
webserver_template integer optional The ID of your webserver template saved in your account to create site with this template
webhook_url url optional A URL to your system to get notified on when the site has been installed (contents of this URL down in this document)

Example request:

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

Example response:

HTTP/1.1 201 CREATED
Content-Type: application/json

{
    "data": {
        "id": 1,
        "server_id": 1,
        "domain": "domain4.com",
        "deploy_script": false,
        "web_directory": "/public",
        "project_type": null,
        "project_root": "/",
        "last_deploy_at": null,
        "system_user": "ploi",
        "php_version": 7.2,
        "health_url": null,
        "notification_urls": {
            "slack": null,
            "discord": null,
            "webhook": null
        },
        "has_repository": true,
        "created_at": "2019-07-29 10:27:32"
    }
}

Contents of webhook URL data (optional webhook_url field)

Example response:

POST
Content-Type: application/json

{
  "message": "Site example.com has been created",
  "server": {
    "id": 1,
    "name": "royal-reef"
  },
  "site": {
    "id": 1,
    "domain": "example.com",
    "ip": "127.0.0.1",
    "paths": {
        "public": "/home/ploi/example.com/public",
        "server": "/home/ploi/example.com"
    }
  }
}