All Products
Search
Document Center

Resource Management:ListResourceShares

Last Updated:Aug 28, 2026

Queries resource shares.

Operation description

The following example shows how to query the resource shares created by the current Alibaba Cloud account in the cn-hangzhou region. The response shows that the account 151266687691**** has the following resource shares:

  • rs-hX9wC5jO****, which is in the Deleted state

  • rs-PqysnzIj****, which is in the Active state

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

ResourceOwner

string

Yes

The owner of the resource shares. Valid values:

  • Self: the current account

  • OtherAccounts: an account other than the current account

Self

ResourceShareName

string

No

The name of the resource share.

test

ResourceShareStatus

string

No

The status of the resource shares. Valid values:

  • Active

  • Pending

  • Deleting

  • Deleted

Note

The system automatically deletes the records of resource shares in the Deleted state within 48 hours to 96 hours after you delete the resource shares.

Active

MaxResults

integer

No

The maximum number of entries to return for a single request.

Valid values: 1 to 100. Default value: 20.

20

NextToken

string

No

The pagination token for the next request. If the response is truncated, use this token to retrieve the remaining records.

TGlzdFJlc291cm****

ResourceShareIds

array

No

The IDs of the resource shares.

Valid values of N: 1 to 5. A maximum of five resource shares can be specified at a time.

rs-PqysnzIj****

string

No

The ID of a resource share.

rs-PqysnzIj****

PermissionName

string

No

The information about the permissions. For more information, see Permission library.

AliyunRSDefaultPermissionVSwitch

ResourceGroupId

string

No

The ID of the resource group.

rg-aekz5nlvlak****

Tag

array<object>

No

The tags.

object

No

A tag.

Key

string

No

The tag key.

Note

The tag key can be 128 characters in length and cannot start with acs: or aliyun. The tag key cannot contain http:// or https://.

k1

Value

string

No

The tag value.

Note

The tag value can be 128 characters in length and cannot start with acs:. The tag value cannot contain http:// or https://.

v1

For more information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

The returned result.

NextToken

string

The pagination token for the next request. If the response is truncated, use this token to retrieve the remaining records.

TGlzdFJlc291cm****

RequestId

string

The request ID.

2F23CFB6-A721-4E90-AC1E-0E30FA8B45DA

ResourceShares

array<object>

The resource shares.

array<object>

A resource share.

AllowExternalTargets

boolean

Indicates whether resources in the resource share can be shared with accounts outside the resource directory. Valid values:

  • false: Resources in the resource share can be shared only with accounts in the resource directory.

  • true: Resources in the resource share can be shared with both accounts in the resource directory and accounts outside the resource directory.

false

CreateTime

string

The time when the resource share was created.

2020-12-03T02:20:31.292Z

ResourceGroupId

string

The ID of the resource group.

rg-aekz5nlvlak****

ResourceShareId

string

The ID of the resource share.

rs-PqysnzIj****

ResourceShareName

string

The name of the resource share.

test

ResourceShareOwner

string

The owner of the resource share.

151266687691****

ResourceShareStatus

string

The status of the resource share. Valid values:

  • Active

  • Pending

  • Deleting

  • Deleted

Note

The system automatically deletes the records of resource shares in the Deleted state within 48 hours to 96 hours after you delete the resource shares.

Active

Tags

array<object>

The tags.

object

A tag.

Key

string

The tag key.

k1

Value

string

The tag value.

v1

UpdateTime

string

The time when the resource share was updated.

2020-12-03T08:01:43.638Z

Examples

Success response

JSON format

{
  "NextToken": "TGlzdFJlc291cm****",
  "RequestId": "2F23CFB6-A721-4E90-AC1E-0E30FA8B45DA",
  "ResourceShares": [
    {
      "AllowExternalTargets": false,
      "CreateTime": "2020-12-03T02:20:31.292Z",
      "ResourceGroupId": "rg-aekz5nlvlak****",
      "ResourceShareId": "rs-PqysnzIj****",
      "ResourceShareName": "test",
      "ResourceShareOwner": "151266687691****",
      "ResourceShareStatus": "Active",
      "Tags": [
        {
          "Key": "k1",
          "Value": "v1"
        }
      ],
      "UpdateTime": "2020-12-03T08:01:43.638Z"
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 MissingParameter.ResourceOwner You must specify ResourceOwner.
400 InvalidParameter.ResourceOwner The ResourceOwner is invalid.
400 InvalidParameter.ResourceShareName The ResourceShareName is invalid.
400 InvalidParameter.ResourceShareName.Length The maximum length of ResourceShareName exceeds 50 characters.
400 InvalidParameter.ResourceShareStatus The ResourceShareStatus is invalid.
400 InvalidParameter.MaxResults The MaxResults is invalid.
400 InvalidParameter.NextToken The NextToken is invalid.
400 InvalidParameter.NextToken.Length The maximum length of NextToken exceeds 256 characters.
400 InvalidParameter.ResourceShareIds The ResourceShareIds is invalid.
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values.
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters.
400 InvalidParameter The specified parameter is invalid.
400 InvalidParameter.ResourceOwnerAndTag You cannot use ResourceOwner set to OtherAccounts and tags in one request.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.