Roman Kozin Roman Kozin - 4 years ago 177
PHP Question

Google Drive API | PHP

We are facing some problems on searching query.
When we searching by

field with conditions as
imageMediaMetadata has {key=, value=}
or even with simple
, as mentioned in documentation - error will be occur.

Fields are selected :
files(imageMediaMetadata, name, id)

With simple
search - it's OK.

Search by MIME-TYPE

But, when we will try to do another request, with imageMediaMetadata fields(keys) - it will fail.

Fail on imageMediaMetadata search

We have tried requests with property keys and accessing to object with dot - nothing work. All scopes that needed - are granted.


Even if width parameter was passed as integer - it still does not work.
We are trying to get photos, where
imageMediaMetadata.time > t
, where t is user-defined time

Answer Source

You cant search on every field there are specific ones you can search on they are

Field Value Type Operators Description
title string contains1, =, != Title of the file.
fullText string contains2 Full text of the file including title, description, content, and indexable text.
mimeType string contains, =, != MIME type of the file.
modifiedDate date3 <=, <, =, !=, >, >= Date of the last modification of the file.
lastViewedByMeDate date3 <=, <, =, !=, >, >= Date that the user last viewed a file.
trashed boolean =, != Whether the file is in the trash or not.
starred boolean =, != Whether the file is starred or not.
parents collection in Whether the parents collection contains the specified ID.
owners collection in Users who own the file.
writers collection in Users who have permission to modify the file.
readers collection in Users who have permission to read the file.
sharedWithMe boolean =, != Files that have been shared with the authorized user.
properties collection has Custom file properties.

A full list of valid search parameters can be found here really though they would have fixed this in V3

An idea would be to update the files and add custom properties that you could then search on but this may or may not work for you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download