I’m having trouble with search queries in the Google Drive API using PHP. When I try to search using photoMetadata fields, I keep getting errors.
Working Query:
$searchQuery = "mimeType='image/jpeg'";
$response = $driveService->files->listFiles([
'q' => $searchQuery,
'fields' => 'files(id, name, mimeType)'
]);
Failing Query:
$searchQuery = "photoMetadata.width > 1000";
$response = $driveService->files->listFiles([
'q' => $searchQuery,
'fields' => 'files(id, name, photoMetadata)'
]);
I’ve tried different approaches like using photoMetadata has {key='width', value='1200'} and accessing nested properties with dot notation, but nothing works. I have all the required scopes enabled.
What I’m trying to achieve is getting images where photoMetadata.timestamp > userTime. The basic MIME type searches work fine, but any query involving image metadata properties fails.
Has anyone successfully searched using image metadata fields? Am I missing something in the query syntax?