All Products
Search
Document Center

Key Management Service:ListAliasesByKeyId

更新時間:Jun 14, 2024

Queries all aliases of a key.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes ListAliasesByKeyId

The operation that you want to perform. Set the value to ListAliasesByKeyId.

KeyId String Yes key-hzz630494463ejqjx****

The ID or Alibaba Cloud Resource Name (ARN) of the key.

Note When you access a key within another Alibaba Cloud account, you must enter the ARN of the key. The key ARN is in the acs:kms:${region}:${account}:key/${keyid} format.
PageNumber Integer No 1

The page number.

Valid values: an integer that is greater than 0.

Default value: 1.

PageSize Integer No 10

The number of entries per page.

Valid values: 0 to 101.

Default value: 10.

Response parameters

Parameter

Type

Example

Description

RequestId String 1b57992c-834b-4811-a889-f8bac1ba0353

The ID of the request, which is used to locate and troubleshoot issues.

PageNumber Integer 1

The page number.

PageSize Integer 10

The number of entries per page.

TotalCount Integer 1

The total number of entries returned.

Aliases Array of Alias

A list of alias.

Alias
KeyId String key-hzz630494463ejqjx****

The ID of the key. If KeyId in the request is set to the ARN of the key, the key ID is returned in the response.

AliasArn String acs:kms:cn-hangzhou:123456:alias/ExampleAlias1

The ARN of the alias.

AliasName String alias/ExampleAlias1

The ID of the alias.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListAliasesByKeyId
&KeyId=key-hzz630494463ejqjx****
&PageNumber=1
&PageSize=10
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListAliasesByKeyIdResponse>
    <RequestId>1b57992c-834b-4811-a889-f8bac1ba0353</RequestId>
    <PageNumber>1</PageNumber>
    <PageSize>10</PageSize>
    <TotalCount>1</TotalCount>
    <Aliases>
        <KeyId>key-hzz630494463ejqjx****</KeyId>
        <AliasArn>acs:kms:cn-hangzhou:123456:alias/ExampleAlias1</AliasArn>
        <AliasName>alias/ExampleAlias1</AliasName>
    </Aliases>
</ListAliasesByKeyIdResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "1b57992c-834b-4811-a889-f8bac1ba0353",
  "PageNumber" : 1,
  "PageSize" : 10,
  "TotalCount" : 1,
  "Aliases" : [ {
    "KeyId" : "key-hzz630494463ejqjx****",
    "AliasArn" : "acs:kms:cn-hangzhou:123456:alias/ExampleAlias1",
    "AliasName" : "alias/ExampleAlias1"
  } ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The specified parameter is not valid. The specified parameter is invalid.

For a list of error codes, see Service error codes.