Querying the Key List
Function
This API is used to query the key list.
Calling Method
For details, see Calling APIs.
URI
POST /v1.0/{project_id}/kms/list-keys
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID. Constraints N/A Range The value returned by the IAM API is used, which contains 32 characters. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition 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. Constraints N/A Range Obtain the value by calling the IAM API for obtaining the user token. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| limit | No | String | Definition Number of returned records Constraints The value of limit must be an integer. Range 1 to 2000 Default Value 2000 |
| marker | No | String | Definition Start position of pagination query. Set marker to the value of next_marker in the response body of the previous page. Constraints Parameters marker and limit must be used together. If the number of records returned on the last page is less than the value of limit, the query ends. Range N/A Default Value N/A |
| key_state | No | String | Definition Key status Constraints The value must match the regular expression ^[1-5]{1}$. Range Default Value N/A |
| key_spec | No | String | Definition Key generation algorithm. To query all keys (including asymmetric keys), set the parameter to ALL. Constraints N/A Range Default Value AES_256 |
| enterprise_project_id | No | String | Definition Enterprise multi-project ID Constraints If enterprise multi-project is not enabled, you do not need to set this field. If enterprise multi-project is enabled, you can set this field when querying resources. Range The value must meet either of the following conditions: Default Value By default, all resources in the enterprise multi-project with allowed permissions are queried. In this case, the value is all. |
| keystore_type | No | String | Definition Dedicated keystore cluster type Constraints N/A Range Default Value N/A |
| sequence | No | String | Definition A 36-byte serial number of a request message, for example, 919c82d4-8046-4722-9094-35c3c6524cff. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| keys | Array of strings | Definition Key ID list Range N/A |
| key_details | Array of KeyDetails objects | Definition Key details list Range N/A |
| next_marker | String | Definition Value of marker used for obtaining the next page of results. If truncated is false, next_marker is left blank. Range N/A |
| truncated | String | Definition Whether there is a next page Range |
| total | Integer | Definition Total number of keys Range N/A |
Example Requests
Query the keys whose aliases start with 1. At most two keys are returned.
{
"limit" : "2",
"marker" : "1"
} Example Responses
Status code: 200
Request succeeded.
{
"keys" : [ "0d0466b0-e727-4d9c-b35d-f84bb474a37f", "2e258389-bb1e-4568-a1d5-e1f50adf70ea" ],
"key_details" : [ {
"key_id" : "0d0466b0-e727-4d9c-b35d-f84bb474a37f",
"domain_id" : "00074811d5c27c4f8d48bb91e4a1dcfd",
"key_alias" : "test",
"realm" : "cn-north-7",
"key_description" : "key_description",
"creation_date" : "1502799822000",
"scheduled_deletion_date" : "",
"key_spec" : "AES_256",
"key_usage" : "ENCRYPT_DECRYPT",
"key_state" : "2",
"default_key_flag" : "0",
"key_type" : "1",
"expiration_time" : "1501578672000",
"origin" : "kms",
"key_rotation_enabled" : "true",
"sys_enterprise_project_id" : "0",
"keystore_id" : "0",
"keystore_type" : "DEFAULT"
}, {
"key_id" : "2e258389-bb1e-4568-a1d5-e1f50adf70ea",
"domain_id" : "00074811d5c27c4f8d48bb91e4a1dcfd",
"key_alias" : "test",
"realm" : "realm",
"key_description" : "key_description",
"creation_date" : "1502799822000",
"scheduled_deletion_date" : "",
"key_spec" : "AES_256",
"key_usage" : "ENCRYPT_DECRYPT",
"key_state" : "2",
"default_key_flag" : "0",
"key_type" : "1",
"expiration_time" : "1501578672000",
"origin" : "kms",
"key_rotation_enabled" : "true",
"sys_enterprise_project_id" : "0",
"keystore_id" : "0",
"keystore_type" : "DEFAULT"
} ],
"next_marker" : "",
"truncated" : "false",
"total" : 2
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
Error Codes
See Error Codes.