CreateCertificate

1. API Description

This API (CreateCertificate) is used to create a certificate.

Note

  • Modifications to the certificate content are not supported. To make changes, you need to create a new certificate.

2. Request Parameters

The following list includes the request parameters required by the API:

Parameter NameRequiredTypeDescription

certificateContent

Yes

String

Certificate content

certificateKey

Yes

String

Certificate key

certificateLabel

No

String

Custom certificate label

Must not exceed 64 characters

resourceGroupId

No

String

ID of the resource group.

If not provided, the default resource group will be used

3. Output Parameters

Parameter NameTypeDescription

certificateId

String

Certificate ID

requestId

String

Unique request ID.

Returned with every request. This request's requestId is needed when troubleshooting.

4. Code Example

  1. Upload a certificate.

POST / HTTP/1.1
Host: console.zenlayer.com/api/v2/cdn
Content-Type: application/json
X-TC-Action: CreateCertificate
<Common Request Params>

Request:
{
  "certificateContent": "-----BEGIN CERTIFICATE----- MIIGDTCC****** -----END CERTIFICATE-----",
  "certificateKey": "-----BEGIN RSA PRIVATE KEY----- MIIEogIB****** -----END RSA PRIVATE KEY-----",
}

Response:
{
  "requestId": "T6883FCD0-3E7D-44EA-A517-A421A52A27F4",
  "response": {
    "requestId": "T6883FCD0-3E7D-44EA-A517-A421A52A27F4",
    "certificateId": "f0864***66c6fa",
  }
}

5. Error Codes

The following includes error codes encountered in business logic. For other error codes, see Common Error Codes.

HTTP Status CodeError CodeDescription

400

CERTIFICATE_EXPIRED

Certificate has expired

400

CERTIFICATE_CONTENT_NOT_MATCH_KEY

Certificate does not match key

400

INVALID_CERTIFICATE_CONTENT

Parsing failed, please check the certificate content format

400

INVALID_CERTIFICATE_KEY

Parsing failed, please check the key format

400

CERTIFICATE_DUPLICATED

Certificate name or content is duplicated

Last updated