OneDrive Rest API 无法命中正确的端点以列出文档下的所有子文件夹

OneDrive Rest API unable to hit proper endpoint to list all child folders under Documents

我正在针对 OneDrive REST API 进行编码,并且正在访问 https://api.onedrive.com/v1.0/drive/root/children 端点。我可以清楚地看到返回的 JSON 显示文档的 folder 有三个 childCount

我想弄清楚如何构造我的端点以显示文档下的子文件夹。

您有两个选择:

  1. 按名称查询 Documents 的 children
  2. 通过 id
  3. 查询 Documents 的 children

对于前者:

https://api.onedrive.com/v1.0/drive/root:/Documents:/children

对于后者:

https://api.onedrive.com/v1.0/drive/items/<id-of-document>/children

要将返回的 children 限制为仅文件夹,您可以添加过滤器:

https://api.onedrive.com/v1.0/drive/root:/Documents:/children?filter=folder%20ne%20null