Enables a resource directory.

Usage notes

You can use the current account or a newly created account to enable a resource directory. For more information, see Enable a resource directory.

In this example, the current account is used to enable a resource directory.

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 EnableResourceDirectory

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

MAName String No user01@rdadmin.aliyunid.com

The name of the newly created account.

Specify the name in the <Prefix>@rdadmin.aliyunid.com format. The prefix can contain letters, digits, and special characters but cannot contain consecutive special characters. The prefix must start with a letter or digit and end with a letter or digit. Valid special characters include underscores (_), periods (.), and hyphens (-). The prefix must be 2 to 50 characters in length.

MASecureMobilePhone String No xx-13900001234

The mobile phone number that is bound to the newly created account.

If you leave this parameter empty, the mobile phone number that is bound to the current account is used. The mobile phone number you specify must be the same as the mobile phone number that you specify when you call the SendVerificationCodeForEnableRD operation to obtain a verification code.

Specify the mobile phone number in the <Country code>-<Mobile phone number> format.

Note Mobile phone numbers in the 86-<Mobile phone number> format in the Chinese mainland are not supported.
VerificationCode String No 123456

The verification code.

You can call the SendVerificationCodeForEnableRD operation to obtain the verification code.

EnableMode String Yes CurrentAccount

The mode in which you enable a resource directory. Valid values:

  • CurrentAccount: indicates that the current account is used to enable a resource directory.
  • NewManagementAccount: indicates that a newly created account is used to enable a resource directory. If you select this mode, you must configure the MAName, MASecureMobilePhone, and VerificationCode parameters.

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

Response parameters

Parameter Type Example Description
ResourceDirectory Object

The information of the resource directory.

ResourceDirectoryId String rd-54****

The ID of the resource directory.

MasterAccountId String 507408460615****

The ID of the management account.

MasterAccountName String alice@example.com

The name of the management account.

RootFolderId String r-G9****

The ID of the Root folder.

CreateTime String 2021-12-08T02:15:31.744Z

The time when the resource directory was enabled.

RequestId String EC2FE94D-A4A2-51A1-A493-5C273A36C46A

The ID of the request.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=EnableResourceDirectory
&EnableMode=CurrentAccount
&<Common request parameters>

Sample success responses

XML format

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

<EnableResourceDirectoryResponse>
    <RequestId>EC2FE94D-A4A2-51A1-A493-5C273A36C46A</RequestId>
    <ResourceDirectory>
        <ResourceDirectoryId>rd-54****</ResourceDirectoryId>
        <MasterAccountName>alice@example.com</MasterAccountName>
        <RootFolderId>r-G9****</RootFolderId>
        <CreateTime>2021-12-08T02:15:31.744Z</CreateTime>
        <MasterAccountId>507408460615****</MasterAccountId>
    </ResourceDirectory>
</EnableResourceDirectoryResponse>

JSON format

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

{
  "RequestId" : "EC2FE94D-A4A2-51A1-A493-5C273A36C46A",
  "ResourceDirectory" : {
    "ResourceDirectoryId" : "rd-54****",
    "MasterAccountName" : "alice@example.com",
    "RootFolderId" : "r-G9****",
    "CreateTime" : "2021-12-08T02:15:31.744Z",
    "MasterAccountId" : "507408460615****"
  }
}

Error codes

HTTP status code Error code Error message Description
409 Invalid.EnterpriseName You must specify the enterprise name. The error message returned because no enterprise name is specified for the account. Specify an enterprise name for the account.
409 EnterpriseRealNameVerificationError The specified account does not pass enterprise real-name verification. We recommend you first complete enterprise real-name verification for the account. The error message returned because the account does not pass enterprise real-name verification. Complete enterprise real-name verification for the account first.
409 EntityAlreadyExists.ResourceDirectory The resource directory for the account is already enabled. We recommend that you do not enable the resource directory again. The error message returned because the account has been used to enable a resource directory. Do not use the account to enable a resource directory again.
409 InvalidParameter.ManagementAccountName.AlreadyUsed The ManagementAccountName has been used. The error message returned because the name specified for the management account already exists. Change the name.
409 Invalid.VerificationCode The verification code is invalid. The error message returned because the verification code is invalid.
409 InvalidParameter.ManagementAccountName The management account name is in the wrong format. The error message returned because the format of the name specified for the management account is incorrect.
409 InvalidParameter.ManagementAccountSecurityInfo The parameter management account secure mobile phone is invalid. The error message returned because the format of the mobile phone number specified for security purposes is incorrect.
409 MissingSecureMobilePhone Secure mobile phone is missing. The error message returned because no mobile phone number is specified for security purposes.
409 MissingSecurityInfo Security info is missing. The error message returned because security information is not specified.
409 NotSupport.AccountInAnotherResourceDirectory Your account is a management account for another resource directory or a member of another resource directory. The error message returned because your account is the management account or a member of another resource directory.

For a list of error codes, visit the API Error Center.