Google Drive SDK (PHP) Children: list - How to set the query parameter

Question!

I follow the documentation there:

https://developers.google.com/drive/v2/reference/children/list

I would like to set a query in the parameters so i tried to simply do this:

$parameters = array();
$parameters['q'] = "My Query";
$children = $service->children->listChildren($folderId, $parameters);

As written in the doc:

Requests with children.list accept the q parameter, which is a search query combining one or more search terms

But the q is not recognized, i get this error:

An error occurred: (list) unknown parameter: 'q'

What is the right syntax?



Answers
Are you sure you are using the latest version of the PHP client library? I just tried with it and the q parameter is supported when listing children.

Also, make sure that the value of the q parameter matches the search query syntax as explained at https://developers.google.com/drive/search-parameters.

For instance, here is a valid children list request that specifies a query parameter:

$parameters = array();
$parameters['q'] = "title contains 'Drive'";
$children = $service->children->listChildren($folderId, $parameters);


This video can help you solving your question :)
By: admin