GAPI (Google API) Drive. File request with attribute “appProperties” does not work

我的梦境 提交于 2021-01-29 18:42:49

问题


Request parameters:

"q": "appProperties has {key = 'hah' and value = 'vah'}",
"fields": "files (id, name, appProperties)"

By trying the files.list request in the environment of the Google API docks (which is Try it), the request passes and the data is returned correct.

Trying to execute the same request from the application, the request passes, but I get an empty list of files

{
 "kind": "drive # fileList",
 "incompleteSearch": false,
 "files": []
}

Yes, the "incompleteSearch" header also comes: false, but in other queries, even with such a header, the data comes in correctly (maybe you should use nextPageToken?). Moreover, if the same request is made via GAPI (and not via an HTTP, XHR request), then an empty list of files will simply come.

There are no problems with other queries. All rights are granted (for the time being for the test). Other requests are correct. The request is made directly from the browser.


回答1:


It's very simple. appPropperties is a private field and is available only to the application that added it.

In this case, Google API Doc was one application, and mine was another.

Therefore, I could not get the data that was needed, because I did not think that Google’s docks are considered to be another application (although this is logical). Implementing the function to add these attributes from the application when creating/update a file - everything worked.



来源:https://stackoverflow.com/questions/56544174/gapi-google-api-drive-file-request-with-attribute-appproperties-does-not-wo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!