Application Certificate Management

Create an Certificate for Application

Description

Create an Certificate for Application

URI

POST /admin-api/applications/http/{app_id}/phases/ssl_cert/certs

URI Parameters

  • enabled

    type: boolean

    required: yes

    description: Whether to enable this certificate

  • label:

    type: string

    required: no

    description: label for the certificate

  • global_cert

    type: integer

    required: no (when attempting to use a global certificate, it’s required)

    description: id of global certificate. If one wants to use a global certificate, one can use the id of the global certificate to refer to.

  • server_cert

    type: string

    required: no (when attempting to manually upload a certificate, it’s required)

    description: end-entity certificate in pem format

  • priv_key

    type: string

    required: no (when attempting to manually upload a certificate, it’s required)

    description: private key in pem format

  • cert_chain:

    type: string

    required: no

    description: certificate chain, usually no need to upload

  • client_verify

    type: boolean

    required: no

    description: Whether the certificate is used for client certificate validation, the default value is false.

  • ca_cert

    type: string

    required: no (when attempting to enable client_verify, it’s required)

    description: the field is required when using client certificate verification. The client certificate is signed using this ca

  • acme_host

    type: array

    required: no (when attempting to issue certificate via ACME, it’s required)

    description: signing a certificate using acme (allows you to sign multiple certificates at one time, resulting in the same certificate)

  • acme_providers

    type: integer

    required: no

    description: use the certificate issuer that supports ACME as defined in the global configuration. If not specified, Let’s Encrypt will be used

  • acme_csr_type

    type: string

    required: no

    description: specify the encryption algorithm for the ACME issued certificate, which current support ‘rsa’ and ’ec’. The default value is ‘rsa’.

  • acme_use_uploaded_key

    type: boolean

    required: no

    description: whether to use manual uploaded private key for the ACME issued certificate.

  • acme_takeover

    type: boolean

    required: no

    description: whether the specified domains of the uploaded certificate is updated by the specified ACME provider. (the default value is false)

Example Request

Shell

curl -X POST \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/applications/http/1/phases/ssl_cert/certs \
  -d '{"global_cert": 1}'

Example Response

Status: 200 OK
{
  "data": {"id": 1},
  "status": 0
}

Get the application certificate list

Description

Get the application certificate list

URI

GET /admin-api/applications/http/{app_id}/phases/ssl_cert/certs

Example Request

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/applications/http/1/phases/ssl_cert/certs

Example Response

Status: 200 OK
{
  "data": [
    {
      "client_verify": false,
      "enabled": true,
      "global_cert": 1,
      "id": 1,
    }
  ],
  "status": 0
}

Update the certificate of application

Description

Update the certificate of application

URI

PUT /admin-api/applications/http/{app_id}/phases/ssl_cert/certs/{cert_id}

Example Request

Shell

curl -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/applications/http/1/phases/ssl_cert/certs/1 \
  -d '{"global_cert": 2}'

Example Response

Status: 200 OK
{"status":0}

Delete the certificate from application

Description

Delete the certificate from application

URI

DELETE /admin-api/applications/http/{app_id}/phases/ssl_cert/certs/{cert_id}

Example Request

Shell

curl -X DELETE \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/applications/http/1/phases/ssl_cert/certs/1 \

Example Response

Status: 200 OK
{ "status": 0 }