Updated on 2025-05-29 GMT+08:00

Importing a Certificate

Function

Import a certificate to CCM.

URI

POST /v3/scm/certificates/import

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Minimum: 32

Maximum: 2097152

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Certificate name. Enter a string of 3 to 63 characters. Only letters, numbers, underscores (_), hyphens (-), and periods (.) are allowed.

Minimum: 3

Maximum: 63

certificate

Yes

String

Certificate content, which can be an intermediate certificate or a root certificate. If the certificate_chain field is transferred to the certificate chain, this field is set to the certificate. Use the escape character \n or \r\n to replace carriage return and line feed characters.

Minimum: 0

Maximum: 4096

certificate_chain

No

String

Certificate chain, which is optional and can be transferred through the certificate field. Use the escape character \n or \r\n to replace carriage return and line feed characters.

Minimum: 0

Maximum: 8192

private_key

Yes

String

Private key of a certificate.

The private key protected by password cannot be uploaded. The carriage return character must be replaced with the escape character \n or \r\n.

Minimum: 0

Maximum: 4096

duplicate_check

No

Boolean

Whether the same certificate can be uploaded.

  • true: The same certificate can be uploaded.

  • false: disagree

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

certificate_id

String

Certificate ID.

Minimum: 16

Maximum: 16

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code returned for an error request.

Minimum: 3

Maximum: 36

error_msg

String

Error information returned for an error request.

Minimum: 0

Maximum: 1024

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code returned for an error request.

Minimum: 3

Maximum: 36

error_msg

String

Error information returned for an error request.

Minimum: 0

Maximum: 1024

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code returned for an error request.

Minimum: 3

Maximum: 36

error_msg

String

Error information returned for an error request.

Minimum: 0

Maximum: 1024

Example Requests

{
  "name" : "test_cert",
  "certificate" : "-----BEGIN CERTIFICATE---******----END CERTIFICATE----------BEGIN CERTIFICATE-----**********-----END CERTIFICATE-----",
  "private_key" : "-----BEGIN RSA PRIVATE KEY-----*********-----END RSA PRIVATE KEY-----"
}

Example Responses

Status code: 200

Normal return.

{
  "certificate_id" : "scs1600313391074"
}

Status code: 401

Authentication failed.

{
  "error_code" : "SCM.XXX",
  "error_msg" : "XXX"
}

Status code: 403

Access denied.

{
  "error_code" : "SCM.XXX",
  "error_msg" : "XXX"
}

Status code: 500

Failed to complete the request because of an internal server error.

{
  "error_code" : "SCM.XXX",
  "error_msg" : "XXX"
}

Status Codes

Status Code

Description

200

Normal return.

401

Authentication failed.

403

Access denied.

404

Access page not found.

500

Failed to complete the request because of an internal server error.

Error Codes

See Error Codes.