A principal calls the AcceptResourceShareInvitation operation to accept a sharing invitation.
Operation description
Usage notes
You need to accept or reject a sharing invitation only when a resource is shared from outside a resource directory. When a resource is shared within a resource directory, the system accepts the sharing invitation by default, and the principal is not required to perform any operations.
A sharing invitation is valid for 7 days. The principal must accept the invitation within this period.
This topic provides an example of how to accept a sharing invitation with the ID i-pMnItMX19fBJ****
in the cn-hangzhou
region.
Try it now

RAM authorization
Action | Access level | Resource type | Condition key | Dependent action |
resourcesharing:AcceptResourceShareInvitation | update | *All Resource
| None | None |
Request parameters
Parameter | Type | Required | Description | Example |
ResourceShareInvitationId | string | Yes | The ID of the sharing invitation. Call the ListResourceShareInvitations operation to obtain the ID of the sharing invitation. | i-pMnItMX19fBJ**** |
For more information about common request parameters, see Common parameters.
Response elements
Element | Type | Description | Example |
object | The response parameters. | ||
RequestId | string | The request ID. | 08F18B04-47CB-5C0E-A6D2-37DEF5C2A961 |
ResourceShareInvitation | object | The information about the sharing invitation. | |
ResourceShareInvitationId | string | The ID of the sharing invitation. | i-pMnItMX19fBJ**** |
ResourceShareId | string | The ID of the resource share. | rs-ysGRci9z**** |
ResourceShareName | string | The name of the resource share. | example |
SenderAccountId | string | The ID of the Alibaba Cloud account that sent the invitation. | 151266687691**** |
ReceiverAccountId | string | The ID of the Alibaba Cloud account that received the invitation. | 134254031178**** |
CreateTime | string | The time when the invitation was created. The time is displayed in UTC. | 2022-09-02T06:43:12.353Z |
Status | string | The status of the invitation. Valid values:
| AcceptFailed |
AcceptInvitationFailedDetails | array<object> | The details about the failure to accept the invitation to the resource share. | |
object | The details about the failure to accept the invitation to the resource share. | ||
Status | string | This parameter is deprecated. Use FailureReason instead. | None |
StatusMessage | string | This parameter is deprecated. Use FailureDescription instead. | None |
AssociateType | string | This parameter is deprecated. Use OperationType instead. | None |
ResourceArn | string | The Alibaba Cloud Resource Name (ARN) of the shared resource. | acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
ResourceType | string | The type of the shared resource. For more information about the resource types that can be shared, see Alibaba Cloud services that support resource sharing. | Snapshot |
FailureReason | string | The reason why the check for accepting the invitation to the resource share fails. Valid values:
| Unavailable |
FailureDescription | string | The description of the failure to accept the invitation to the resource share. | You cannot access the specified resource at this time. |
OperationType | string | The type of the operation. Valid values:
| Associate |
ResourceId | string | The ID of the shared resource. | s-7xvh46nx5oqlre0wv*** |
Examples
Success response
JSON
format
{ "RequestId": "08F18B04-47CB-5C0E-A6D2-37DEF5C2A961", "ResourceShareInvitation": { "ResourceShareInvitationId": "i-pMnItMX19fBJ****", "ResourceShareId": "rs-ysGRci9z****", "ResourceShareName": "example", "SenderAccountId": "151266687691****", "ReceiverAccountId": "134254031178****", "CreateTime": "2022-09-02T06:43:12.353Z", "Status": "AcceptFailed", "AcceptInvitationFailedDetails": [ { "Status": "None", "StatusMessage": "None", "AssociateType": "None", "ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****", "ResourceType": "Snapshot", "FailureReason": "Unavailable", "FailureDescription": "You cannot access the specified resource at this time.", "OperationType": "Associate", "ResourceId": "s-7xvh46nx5oqlre0wv***" } ] } }
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.ResourceShareInvitationId | The ResourceShareInvitationId is invalid. | The invitation ID is invalid. |
400 | MissingParameter.ResourceShareInvitationId | You must specify ResourceShareInvitationId. | You must specify an invitation ID. |
409 | InvitationStatus.Expired | The resource share invitation status is expired. | The invitation has expired. |
409 | EntityNotExists.ResourceShareInvitation | The resource share invitation does not exist in the current account. | The invitation does not exist. |
409 | InvitationStatus.AlreadyRejected | The resource share invitation status is rejected. | The invitation has been rejected. |
409 | InvitationStatus.AlreadyAccepted | The resource share invitation status is alredy accepted. | The invitation has been accepted. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.