Drive API - List of Multiple Mime Types

Is there a way to make one call to search for multiple mimeTypes at once? For example, I try to find all mp3 files in a folder. It seems you need to make a call for each individual mimeType to find all different ones similar to this:

https://www.googleapis.com/drive/v2/files?key=aaamykeyaaa&q=mimeType= 'audio / mpeg' https://www.googleapis.com/drive/v2/files?key=aaamykeyaaa&q=mimeType= ' audio / mpeg3 ' https://www.googleapis.com/drive/v2/files?key=aaamykeyaaa&q=mimeType= ' audio / mp3 '

Is there no way to include multiple mimeTypes in a single request? It is very inefficient to do it this way.

Thanks.

+6
source share
2 answers

In the legacy document list API in which you just installed "type: audio" in the request. I cannot find something like this in the Drive API, but you can try using some undocumented search functions:

  • use the contains statement for mimeType: mimeType contains 'audio /'
  • use the or operator: mimeType = 'audio / mpeg' or mimeType = 'audio / mp3' or ...
  • you can also use other operators: mimeType> 'audio /' and mimeType <'Audio / ~'

I think they are undocumented because they are poorly indexed. If the user has many files, you may need to split pages into many pages with empty elements before you get the results. You can also get more speed limit restrictions if you try to request this request because it is taxed on your servers. It may be more efficient to query each mimeType type separately. The Drive API should provide a new operator (e.g. startswith) or a new parameter for these types of requests (similar to the document API).

+1
source

Yes, you can do this:

(mimeType = 'audio/mpeg' or mimeType = 'audio/mpeg3' or mimeType = 'audio/mp3') 
+1
source

All Articles