简体   繁体   中英

unknown parameter: 'pageSize' in Google\Service\Resource.php

Solved: I did not place Drive.php in correctly in step 2 in the below link.

I am new to php and working on a project that uploads files to google drive. To start with, I followed the example given in google developer site

Faced couple of issues: First issue was in step 4 , I have multiple accounts signed in, by clicking on one account and accept, it should give me the verification code, but i got 400 error saying "Invalid request, missing required parameter: redirect_uri". After I modified project entry in developer console to have a dummy redirect_uri which fails to load but still I can access the verification code from the URL parameter in browser window. It is a hack, please let me know if there is a better way to handle it (should I run a webserver at my end to handle the redirect_url?)

Second issue is: After successful authentication, it threw below error

PHP Fatal error:  Uncaught exception 'Google_Exception' with message '(list) unknown parameter: 'pageSize'' in C:\xampp\htdocs\driveapi\vendor\google\apiclient\src\Google\Service\Resource.php:151 
Stack trace:
#0    C:\xampp\htdocs\driveapi\vendor\google\apiclient\src\Google\Service\Drive.php(18 72): Google_Service_Resource->call('list', Array, 'Google_Service_...')
#1 C:\xampp\htdocs\driveapi\drivephp.php(82): Google_Service_Drive_Files_Resource->listFiles(Array)
#2 {main}
thrown in C:\xampp\htdocs\driveapi\vendor\google\apiclient\src\Google\Service\Resource.php on line 151

Fatal error: Uncaught exception 'Google_Exception' with message '(list) unknown parameter: 'pageSize'' in C:\xampp\htdocs\driveapi\vendor\google\apiclient\src\Google\Service\Resource.php on line 151

Google_Exception: (list) unknown parameter: 'pageSize' in C:\xampp\htdocs\driveapi\vendor\google\apiclient\src\Google\Service\Resource.php on line 151

Call Stack:
0.0008     135592   1. {main}() C:\xampp\htdocs\driveapi\drivephp.php:0
0.0408    2398408   2. Google_Service_Drive_Files_Resource->listFiles() C:\xampp\htdocs\driveapi\drivephp.php:82
0.0409    2399360   3. Google_Service_Resource->call() C:\xampp\htdocs\driveapi\vendor\google\apiclient\src\Google\Service\Drive.php:1872

Other details:

Php version: 5.6.19 (32-bit)

Google apiclient: tried with both "google/apiclient:1.*" and "google/apiclient:1.0.*@beta"

Hope I am clear. Thanks in advance.

As @avil responded to itself, you have to 'trick' the composer version, but you can use the github version to avoid modifying the vendor folder content by putting this in your composer.json:

{
[...]
"repositories": [{
    "type": "vcs",
    "url": "https://github.com/google/google-api-php-client"
}],
"require": {
    "google/apiclient": "dev-v1-master"
}
[...]
}

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