aditya1000 / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
1 stars 0 forks source link

Google Prediction API serviceAccount not working #152

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. set up all credentials in file serviceAccount.php (I've signed up for an 
Oauth Service Account )
2. Load the page

What is the expected output? What do you see instead?
I should see the same result as in index.php file (that is working correctly) 
but instead I see this error:

Fatal error: Uncaught exception 'apiServiceException' with message 'Error 
calling POST 
https://www.googleapis.com/prediction/v1.4/trainedmodels/languageidentifier/pred
ict: (404) No Model found. Model must first be trained.' in 
/Users/Edoardo/Sites/google-api-php-client/src/io/apiREST.php on line 67 
apiServiceException: Error calling POST 
https://www.googleapis.com/prediction/v1.4/trainedmodels/languageidentifier/pred
ict: (404) No Model found. Model must first be trained. in 
/Users/Edoardo/Sites/google-api-php-client/src/io/apiREST.php on line 67 Call 
Stack: 0.0068 663776 1. {main}() 
/Users/Edoardo/Sites/prediction/serviceAccount.php:0 0.0157 2316176 2. 
TrainedmodelsServiceResource->predict() 
/Users/Edoardo/Sites/prediction/serviceAccount.php:69 0.0157 2317624 3. 
apiServiceResource->__call() 
/Users/Edoardo/Sites/google-api-php-client/src/contrib/apiPredictionService.php:
38 1.5220 2333216 4. apiREST::execute() 
/Users/Edoardo/Sites/google-api-php-client/src/service/apiServiceResource.php:17
8 2.2723 2336664 5. apiREST::decodeHttpResponse() 
/Users/Edoardo/Sites/google-api-php-client/src/io/apiREST.php:36

by the way... the model IS there (again, the example in index.php is working)

What version of the product are you using? On what operating system?
Version 1.4 on OsX

Please provide any additional information below.

Original issue reported on code.google.com by edoard...@daviom.com on 4 Jul 2012 at 9:20

GoogleCodeExporter commented 8 years ago
Getting the same issue!

Original comment by awhitesi...@gmail.com on 4 Oct 2012 at 4:27

GoogleCodeExporter commented 8 years ago
If you train the model using the API Explorer, then you get a Model Not Found 
error when using the Service Account authentication method.

The solution is to just train your model using the PHP Client and Service 
account authentication.

Original comment by greg@siteorigin.com on 19 Nov 2012 at 3:52

GoogleCodeExporter commented 8 years ago
Thanks greg!

Original comment by ianbar...@google.com on 22 Mar 2013 at 2:24