简体   繁体   中英

GData Documents List API: retrieving list of folders & files by type

I would like to retrieve a list of all folders in user's account & files that have specific mime-types, for example, application/msword & application/pdf

I use next query: https://docs.google.com/feeds/default/private/full/folder%3Aroot/contents/-/%7Bhttp%3A%2F%2Fschemas.google.com%2Fg%2F2005%23kind%7Dapplication%2Fmsword/%7Bhttp%3A%2F%2Fschemas.google.com%2Fg%2F2005%23kind%7Dapplication%2Fpdf/%7Bhttp%3A%2F%2Fschemas.google.com%2Fg%2F2005%23kind%7Dimage%2Fjpg?max-results=1000&showfolders=true&sortorder=ascending

In response I get only pdf and MS Word files, no folders

You're using the older docslist rather than the new Drive SDK.

In Drive you could use this

GET https://www.googleapis.com/drive/v2/files?maxResults=1000&q=mimeType+%3D+ 'application%2Fmsword'+or+mimeType+%3D+'application%2Fpdf'+or+mimeType+%3D+'application%2Fvnd.google-apps.folder'+&key={YOUR_API_KEY}

If you go to https://developers.google.com/drive/v2/reference/files/list#try-it you can try it for yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM