All Products
Search
Document Center

Key Management Service:ListSecretVersionIds

更新時間:May 16, 2024

Queries all versions of a secret.

The secret value is not included in the returned version information. By default, only the secret versions that have stage labels are returned.

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 ListSecretVersionIds

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

SecretName String Yes secret001

The Alibaba Cloud Resource Name (ARN) of the secret or secret resource.

Note When you access a secret within another Alibaba Cloud account, you must enter the ARN of the secret. The ARN is in the acs:kms:${region}:${account}:secret/${secret-name} format.
IncludeDeprecated String No false

Specifies whether the secret versions that do not have stage labels are returned.

Valid values:

  • false (default)
  • true
PageNumber Integer No 1

The page number. Default value: 1.

PageSize Integer No 10

The number of entries per page. Default value: 20.

Response parameters

Parameter

Type

Example

Description

SecretName String secret001

The secret name.

RequestId String 5b75d8b1-5b6a-4ec0-8e0c-c08befdfad47

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

PageSize Integer 10

The number of entries per page.

PageNumber Integer 1

The page number.

TotalCount Integer 1

The total number of entries returned.

VersionIds Array of VersionId

A list of secret versions.

VersionId
VersionId String v1

The version ID.

CreateTime String 2024-02-21T15:39:26Z

The time when the secret version is created.

VersionStages Array of String {"VersionStage": ["ACSCurrent","uStage1"]}

The stage labels that mark the secret version.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListSecretVersionIds
&SecretName=secret001
&IncludeDeprecated=false
&PageNumber=1
&PageSize=10
&Common request parameters

Sample success responses

XML format

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

<ListSecretVersionIdsResponse>
    <SecretName>secret001</SecretName>
    <RequestId>5b75d8b1-5b6a-4ec0-8e0c-c08befdfad47</RequestId>
    <PageSize>10</PageSize>
    <PageNumber>1</PageNumber>
    <TotalCount>1</TotalCount>
    <VersionIds>
        <VersionId>v1</VersionId>
        <CreateTime>2024-02-21T15:39:26Z</CreateTime>
        <VersionStages>{"VersionStage": ["ACSCurrent","uStage1"]}</VersionStages>
    </VersionIds>
</ListSecretVersionIdsResponse>

JSON format

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

{
  "SecretName" : "secret001",
  "RequestId" : "5b75d8b1-5b6a-4ec0-8e0c-c08befdfad47",
  "PageSize" : 10,
  "PageNumber" : 1,
  "TotalCount" : 1,
  "VersionIds" : [ {
    "VersionId" : "v1",
    "CreateTime" : "2024-02-21T15:39:26Z",
    "VersionStages" : [ "{\"VersionStage\": [\"ACSCurrent\",\"uStage1\"]}" ]
  } ]
}

Error codes

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