Queries the information of all the parent folders of a specified folder. The system returns the information of the folders based on their top-down hierarchy.

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 ListAncestors

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

ChildId String Yes fd-i1c9nr****

The ID of the child folder.

Response parameters

Parameter Type Example Description
Folders Array

The information of the folders.

Folder
CreateTime String 2019-01-18T10:03:35.217Z

The time when the folder was created.

FolderId String r-b1****

The ID of the folder.

FolderName String root

The name of the folder.

RequestId String 83AFBEB6-DC03-406E-9686-867461FF6698

The ID of the request.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=ListAncestors
&ChildId=fd-i1c9nr****
&<Common request parameters>

Sample success responses

XML format

<ListAncestorsResponse>
      <Folders>
          <Folder>
              <FolderName>root</FolderName>
              <FolderId>r-b1****</FolderId>
              <CreateTime>2019-01-18T10:03:35.217Z</CreateTime>
          </Folder>
          <Folder>
              <FolderName>myFirstFd</FolderName>
              <FolderId>fd-0adR35****</FolderId>
              <CreateTime>2019-01-23T08:48:37.530Z</CreateTime>
          </Folder>
      </Folders>
      <RequestId>83AFBEB6-DC03-406E-9686-867461FF6698</RequestId>
</ListAncestorsResponse>

JSON format

{
  "Folders": {
    "Folder": [
      {
        "FolderName": "root",
        "FolderId": "r-b1****",
        "CreateTime": "2019-01-18T10:03:35.217Z"
      },
      {
        "FolderName": "myFirstFd",
        "FolderId": "fd-0adR35****",
        "CreateTime": "2019-01-23T08:48:37.530Z"
      }
    ]
  },
  "RequestId": "83AFBEB6-DC03-406E-9686-867461FF6698"
}

Error codes

HTTP status code Error code Error message Description
400 MissingParameter.ChildId You must specify ChildId. The error message returned because the ChildId parameter is not specified. Specify this parameter.
400 InvalidParameter.ChildId The ChildId is invalid. The error message returned because the value of the ChildId parameter is invalid. The value must start with r- followed by 6 characters or start with fd- followed by 10 characters. Valid characters are letters and digits.
404 EntityNotExists.ResourceDirectory The resource directory for the account is not enabled. We recommend that you first enable the resource directory for the account. The error message returned because the resource directory for the account is not enabled. Enable the resource directory for the account.
404 EntityNotExists.Folder The resource directory folder does not exist. The error message returned because the folder does not exist. Create the folder first.

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