Ploi API

Create certificate

Create a certificate in your site

POST api/servers/{server}/sites/{site}/certificates

Parameters

Parameter Type Status Description
type string required Possible values: letsencrypt, custom
certificate string required When type is 'letsencrypt' enter the domain you want to request SSL for, when type is custom enter the certificate contents
private string required when type is custom When type is custom enter the private key for the certificate

Example request for Let's Encrypt:

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

Example request for custom certificate:

curl -X POST "https://ploi.io/api/servers/{server}/sites/{site}/certificates" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
   --data '{"type":"custom", "certificate":"...", "private": "..." }'

Example response:

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

{
    "data": {
        "id": 1,
        "status": "created",
        "domain": "domain.com",
        "type": "letsencrypt",
        "site_id": 1,
        "server_id": 1,
        "expires_at": null,
        "created_at": "2019-07-31 08:34:25"
    }
}