Updated on 2025-02-14 GMT+08:00

Creating a Certificate

Function

This API is used to create a certificate.

URI

POST /v1/{project_id}/cae/certificates

Table 1 Path parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. See Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Maximum characters: 16,384

X-Enterprise-Project-ID

No

String

Enterprise project ID.

  • When an environment is created, it will be bound with an enterprise project ID.
  • Enter 0 or up to 36 characters in UUID format with hyphens (-).
  • If this parameter is not specified or set to 0, resources in the default enterprise project are queried.
NOTE:

For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide.

X-Environment-ID

Yes

String

Environment ID.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

api_version

Yes

String

API version. Fixed value: v1.

Enumerated value:

  • v1

kind

Yes

String

API type. Fixed value: Certificate.

Enumerated value:

  • Certificate

metadata

Yes

CreateMetaCert object

Metadata for creating a certificate.

spec

Yes

CreateSpecCert object

Certificate specifications.

Table 4 CreateMetaCert

Parameter

Mandatory

Type

Description

name

Yes

String

Certificate name.

Table 5 CreateSpecCert

Parameter

Mandatory

Type

Description

crt

Yes

String

Content of the certificate.

key

Yes

String

Private key.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

api_version

String

API version. Fixed value: v1.

Enumerated value:

  • v1

kind

String

API type. Fixed value: Certificate.

Enumerated value:

  • Certificate

items

Array of CertItem objects

Certificate list.

Table 7 CertItem

Parameter

Type

Description

metadata

MetaCert object

Response data.

spec

SpecCert object

Response data.

Table 8 MetaCert

Parameter

Type

Description

id

String

Certificate ID.

name

String

Certificate name.

Table 9 SpecCert

Parameter

Type

Description

crt

String

Content of the certificate.

key

String

Private key.

created_at

String

Creation time.

Example Request

Create certificate test: Specify crt (server certificate content) and key (server private key).

POST https://{endpoint}/v1/{project_id}/cae/certificates

{
  "api_version" : "v1",
  "kind" : "Certificate",
  "metadata" : {
    "name" : "test"
  },
  "spec" : {
    "crt" : "xxx",
    "key" : "xxx"
  }
}

Example Response

Status code: 200

The request is successful.

{
  "api_version" : "v1",
  "kind" : "Certificate",
  "items" : [ {
    "metadata" : {
      "id" : "d66c5baf-3ab7-49da-92d6-a44aaad1997d",
      "name" : "test"
    },
    "spec" : {
      "crt" : "xxx",
      "key" : "xxx",
      "created_at" : "2023-02-28T07:19:49.610098Z"
    }
  } ]
}

Status Code

Status Code

Description

200

The request is successful.

Error Code

For details, see Error Codes.