Method: children.list

列出文件夹的子级。

HTTP 请求

GET https://www.googleapis.com/drive/v2/files/{folderId}/children

网址采用 gRPC 转码语法。

路径参数

参数
folderId

string

文件夹的 ID。

查询参数

参数
maxResults

integer

要返回的子项数上限。

orderBy

string

以英文逗号分隔的排序键列表。有效键包括 createdDatefolderlastViewedByMeDatemodifiedByMeDatemodifiedDatequotaBytesUsedrecencysharedWithMeDatestarredtitle。默认情况下,每个键都会按升序排序,但也可以使用 desc 修饰符将其反转。用法示例:?orderBy=folder,modifiedDate desc,title. 请注意,目前存在一个限制,如果用户拥有大约一百万个文件,那么请求的排序顺序会被忽略。

pageToken

string

子项的页面令牌。

q

string

用于搜索子项的查询字符串。

请求正文

请求正文必须为空。

响应正文

文件的子项列表。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "nextPageToken": string,
  "kind": string,
  "etag": string,
  "selfLink": string,
  "nextLink": string,
  "items": [
    {
      object (ChildReference)
    }
  ]
}
字段
nextPageToken

string

下一页子节点的页面令牌。如果已达到子列表末尾,则不会出现此字段。如果令牌因任何原因而被拒绝,则应将其舍弃,并且应从结果的第一页重新开始分页。

kind

string

始终为 drive#childList

etag

string

列表的 ETag。

items[]

object (ChildReference)

子项的列表。如果填充了 nextPageToken,则此列表可能不完整,应再提取一页结果。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/docs
  • https://www.googleapis.com/auth/drive
  • https://www.googleapis.com/auth/drive.appdata
  • https://www.googleapis.com/auth/drive.file
  • https://www.googleapis.com/auth/drive.meet.readonly
  • https://www.googleapis.com/auth/drive.metadata
  • https://www.googleapis.com/auth/drive.metadata.readonly
  • https://www.googleapis.com/auth/drive.photos.readonly
  • https://www.googleapis.com/auth/drive.readonly

部分范围受到限制,需要经过安全评估才能让应用使用。有关详情,请参阅授权指南