Updated on 2022-12-22 GMT+08:00

Querying the List of Private Certificates

Function

This API is used to query the private certificate list.

URI

GET /v1/private-certificates

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

The number of returned records. The default value is 10.

Minimum: 0

Maximum: 1000

name

No

String

The name of the private certificate. The set of certificates whose names contain the name field is returned.

Minimum: 1

Maximum: 64

offset

No

Integer

Index position. The query starts from the next data record indexed by this parameter.

Minimum: 0

status

No

String

The private certificate status. You can query private certificates by status.

  • ISSUED: The certificate is issued.

  • REVOKED: The certificate is revoked.

  • EXPIRED: The certificate expired.

sort_key

No

String

Sorting attribute. The following attributes are available now:

  • create_time: Time the certificate was created (default)

  • common_name: The certificate name

  • issuer_name: The name of the CA who issued the certificate.

  • not_after: The certificate expiration time

sort_dir

No

String

Sorting direction. The options are as follows:

  • DESC: descending order (default)

  • ASC: ascending order

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

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

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total

Integer

Total number of private certificates.

Minimum: 0

Maximum: 1000000

certificates

Array of Certificates objects

For details, see data structure for the Certificates field.

Table 4 Certificates

Parameter

Type

Description

certificate_id

String

ID of the private certificate

Minimum: 36

Maximum: 36

status

String

Certificate status:

  • ISSUED: The certificate is issued.

  • EXPIRED: The certificate expired.

  • REVOKED: The certificate is revoked.

issuer_id

String

ID of the parent CA.

Minimum: 36

Maximum: 36

issuer_name

String

The name of the parent CA certificate.

Minimum: 1

Maximum: 64

key_algorithm

String

Key algorithm

signature_algorithm

String

Signature algorithm

freeze_flag

Integer

Freezing tag:

  • 0: The certificate is not frozen.

  • Other values: The certificate is frozen (The type of value is reserved).

gen_mode

String

Certificate generation method.

  • GENERATE: The certificate is generated through the PCA system.

  • IMPORT: The certificate is imported externally.

  • CSR: The CSR is imported externally and issued by the internal CA. The private key is not managed in PCA.

serial_number

String

Serial number.

Minimum: 1

Maximum: 64

create_time

Long

Time the certificate was created. The value is a timestamp in milliseconds.

delete_time

Long

Time the certificate was deleted. The value is a timestamp in milliseconds.

not_before

Long

Time the certificate was created. The value is a timestamp in milliseconds.

not_after

Long

Time the certificate expires. The value is a timestamp in milliseconds.

distinguished_name

DistinguishedName object

Certificate name. For details, see data structure for the DistinguishedName field.

Table 5 DistinguishedName

Parameter

Type

Description

common_name

String

Common certificate name (CN).

Minimum: 1

Maximum: 64

country

String

Country code, which must comply with the regular expression "[A-Za-z]{2}".

Minimum: 2

Maximum: 2

state

String

State or city name.

Minimum: 1

Maximum: 128

locality

String

Country/Region.

Minimum: 1

Maximum: 128

organization

String

Organization name.

Minimum: 1

Maximum: 64

organizational_unit

String

Organization Unit (OU).

Minimum: 1

Maximum: 64

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Example Requests

When you use this API to query the private certificate list, a token is required in the X-Auth-Token field in the request header. The token must have the permission to access the API.

GET https://ccm.ae-ad-1.myhuaweicloud.com/v1/private-certificates

Example Responses

Status code: 200

Request succeeded.

{
  "total" : 2,
  "certificates" : [ {
    "signature_algorithm" : "SHA256",
    "issuer_id" : "ef5d84d1-4f52-47d2-b1c8-a91a672487a0",
    "issuer_name" : "12",
    "not_after" : 1665539214000,
    "not_before" : 1634295475000,
    "status" : "ISSUED",
    "freeze_flag" : 0,
    "gen_mode" : "GENERATE",
    "serial_number" : "202110151057541266081861",
    "distinguished_name" : {
      "country" : "your country abbreviation",
      "state" : "your state",
      "locality" : "your locality",
      "organization" : "your organization",
      "organizational_unit" : "your unit",
      "common_name" : "your CN"
    },
    "key_algorithm" : "RSA4096",
    "create_time" : 1634295475000,
    "delete_time" : null,
    "certificate_id" : "6434f74f-2d13-4e6a-89eb-93ee313f1a43"
  }, {
    "signature_algorithm" : "SHA256",
    "issuer_id" : "ef5d84d1-4f52-47d2-b1c8-a91a672487a0",
    "issuer_name" : "12",
    "not_after" : 1665539214000,
    "not_before" : 1634110315000,
    "status" : "ISSUED",
    "freeze_flag" : 0,
    "gen_mode" : "GENERATE",
    "serial_number" : "202110130731541908887138",
    "distinguished_name" : {
      "country" : "your country abbreviation",
      "state" : "your state",
      "locality" : "your locality",
      "organization" : "your organization",
      "organizational_unit" : "your unit",
      "common_name" : "your CN"
    },
    "key_algorithm" : "RSA4096",
    "create_time" : 1634110316000,
    "delete_time" : null,
    "certificate_id" : "1cbb5a52-806b-469c-b182-7446e1851a1c"
  } ]
}

Status code: 400

Invalid request parameters.

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

Status code: 401

Token required for the requested page.

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

Status code: 403

Authentication failed.

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

Status code: 404

No resources available or found.

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

Status code: 500

Internal service error.

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

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request parameters.

401

Token required for the requested page.

403

Authentication failed.

404

No resources available or found.

500

Internal service error.

Error Codes

See Error Codes.