【问题标题】:Only get back a few properties using Google drive API仅使用 Google Drive API 取回一些属性
【发布时间】:2017-08-15 15:44:07
【问题描述】:

我正在尝试使用 google drive API (v3) 来获取像 https://www.googleapis.com/drive/v3/files/foobar 这样的文件的信息。

但是,在响应中我只得到了文件的四个属性:kindidnamemime_type

根据 google drive api 的文档,我应该得到很多回报(例如所有者,网址)

知道为什么吗?

【问题讨论】:

  • 下面的答案是正确的,但请学会做一些研究。这个问题已经被问过很多次了。
  • developers.google.com/drive/v3/web/query-parameters 假设开发人员将阅读所有文档,而不仅仅是其中的一小部分。 PS,你可能应该接受答案
  • @pinoyyid,是的,我试图研究,但如果同一个问题真的被问过很多次,那么我很确定这个问题本身很难搜索,否则其他人都会找到第一个问题,别再问了,对吧
  • @pinoyyid 好的,也许我们不是 google api 的理想开发人员哈哈。无论如何感谢您的帮助

标签: google-drive-api


【解决方案1】:

当你想检索所有者和url时,你可以使用fields作为查询参数来检索数据。

GET https://www.googleapis.com/drive/v3/files/### file id ###?fields=owners,webViewLink

如果你想用 curl 试试这个,你可以使用下面的 curl 代码。

curl -G -H \
  "Authorization: Bearer ### your access token ###" \
  -d "fields=owners,webViewLink" \
  "https://www.googleapis.com/drive/v3/files/1### file id ###"

详细信息为https://developers.google.com/drive/v3/reference/fileshttps://developers.google.com/drive/v3/web/query-parameters

【讨论】:

  • @pinoyyid 感谢您的支持。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多