Updated on 2024-04-15 GMT+08:00

Querying a Certificate

Function

This API is used to query a certificate.

URI

GET /v1/{project_id}/waf/certificate/{certificate_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. To obtain it, go to Cloud management console and hover the cursor over your username. On the displayed window, choose My Credentials.Then, in the Projects area, view Project ID of the corresponding project.

certificate_id

Yes

String

HTTPS certificate ID. It can be obtained by calling the ListCertificates API.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

You can obtain the ID by calling the ListEnterpriseProject API of EPS.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Content-Type

Yes

String

Content type.

Default: application/json;charset=utf8

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Certificate ID

name

String

Certificate name

content

String

Certificate file, PEM encoding

key

String

Private key of the certificate, which is in PEM format.

expire_time

Long

Certificate expiration timestamp.

exp_status

Integer

Certificate status. The options can be: 0: The certificate has not expired. 1: The certificate expired. 2: The certificate is about to expire.

timestamp

Long

Certificate upload timestamp

bind_host

Array of BindHost objects

Domain name associated with the certificate

Table 5 BindHost

Parameter

Type

Description

id

String

Domain name ID

hostname

String

Domain name

waf_type

String

Deployment mode of WAF instance that is used for the domain name. The value can be cloud for cloud WAF or premium for dedicated WAF instances.

mode

String

This parameter is required only by the dedicated mode.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Requests

GET https://{Endpoint}/v1/{project_id}/waf/certificate/{certificate_id}?enterprise_project_id=0

Example Responses

Status code: 200

OK

{
  "id" : "6e2be127b79f4a418414952ad5d8c59f",
  "name" : "certificatename94319",
  "content"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u5TvSaw8287a6Qo0LyQIfVZSlYYWplT6oiX5rdLzBiap4N0gJWdsa2ihmV59LAQIgK8N+j1daq63b0bJ9k4HruhQtpgxI6U9nFBemH4zTRYM=\n-----END RSA PRIVATE KEY-----",
  "timestamp" : 1650595334578,
  "expire_time" : 1596865564000,
  "bind_host" : [ {
    "id" : "978b411657624c2db069cd5484195d1c",
    "hostname" : "www.demo.com",
    "waf_type" : "cloud"
  } ]
}

Status Codes

Status Code

Description

200

OK

400

Request failed.

401

The token does not have required permissions.

500

Internal server error.

Error Codes

See Error Codes.