Closed GoogleCodeExporter closed 8 years ago
OK, I've corrected some lines, but I still see error:
Fatal error: Uncaught exception 'apiException' with message '(get) unknown
parameter: '1'' in
D:\htdocs\src\explorer\src\service\apiServiceResource.php:120 Stack trace: #0
D:\htdocs\src\explorer\src\contrib\apiAnalyticsService.php(244):
apiServiceResource->__call('get', Array) #1
D:\htdocs\src\explorer\simple.php(41):
DataGaServiceResource->get('ga:58425344', '2012-04-03', '2012-04-17',
'ga:percentNewVi...', Array) #2 {main} thrown in
D:\htdocs\src\explorer\src\service\apiServiceResource.php on line 120
Original comment by seyhunca...@gmail.com
on 17 Apr 2012 at 8:27
if ($client->getAccessToken()) {
$optParams = array( 'dimensions' => $_POST['dimensions'],
'filters' => $_POST['filters'],
'segment' => $_POST['segment'],
'sort' => $_POST['sort'],
'max-results' => $_POST['max_results'],
'start-index' => $_POST['start_index'] );
$data = $service->data_ga->get( $_POST['ids'],
$_POST['start_date'],
$_POST['end_date'],
$_POST['metrics'],
$optParams );
Original comment by seyhunca...@gmail.com
on 17 Apr 2012 at 8:32
is it fixed now?
Original comment by mi...@gravityworksdesign.com
on 2 Jul 2012 at 4:10
Yes, I fixed. Now it works pretty well :)
You can try to catch the error with:
} else {
throw new apiServiceException("Error Goes here...");
}
Also my parameter was wrong. So be careful with ga: and non ga:
Here I share an example
XXXXXXXXX is my id.
https://www.googleapis.com/analytics/v3/data/ga?ids=ga:XXXXXXXXX&metrics=ga:perc
entNewVisits,ga:newVisits,ga:visitors,ga:visits&start-date=2012-04-03&end-date=2
012-04-17&start-index=1&max-results=1000
Happy Coding.
Original comment by seyhunca...@gmail.com
on 3 Jul 2012 at 6:50
BTW: use urlencode();
Original comment by seyhunca...@gmail.com
on 3 Jul 2012 at 7:00
My API is not ready, because I was busy.
So, I will play these days again with GA.
My idea is, there should be a helper class to check values for validation.
For an example: it's for "start-index" should be with if (is_numeric($start) &&
(int)$start > 1)) else ...//err
I guess, the followed lines can help you.
$optParams = array( 'dimensions' => 'ga:pageTitle',
'filters' => '',
//'segment' => '',
//'sort' => '-ga:pageviews',
'max-results' => '50',
'start-index' => '1' );
try {
$data = $service->data_ga->get( 'ga:58425344',
'2012-04-03',
'2012-04-17',
'ga:percentNewVisits,ga:newVisits,ga:visitors,ga:visits',
$optParams );
} catch (apiServiceException $e) {
if(isset($data)) unset($data);
$data['text'] = $e->getMessage();
$data['error'] = $e->getCode();
}
print_r($data);
Original comment by seyhunca...@gmail.com
on 3 Jul 2012 at 7:49
Original comment by ianbar...@google.com
on 22 Mar 2013 at 2:05
i m so upset to this error .
Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error
calling GET
https://www.googleapis.com/plus/v1/people/me?key=AIzaSyC3rTbC9JeSmk_ysb-IkoBD51Z
c1zA5GV8: (403) Access Not Configured. Please use Google Developers Console to
activate the API for your project.' in
C:\xampp\htdocs\googleplus\google-api-php-client\src\io\Google_REST.php:66
Stack trace: #0
C:\xampp\htdocs\googleplus\google-api-php-client\src\io\Google_REST.php(36):
Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1
C:\xampp\htdocs\googleplus\google-api-php-client\src\service\Google_ServiceResou
rce.php(186): Google_REST::execute(Object(Google_HttpRequest)) #2
C:\xampp\htdocs\googleplus\google-api-php-client\src\contrib\Google_PlusService.
php(229): Google_ServiceResource->__call('get', Array) #3
C:\xampp\htdocs\googleplus\google-plus-access.php(36):
Google_PeopleServiceResource->get('me') #4
C:\xampp\htdocs\googleplus\index.php(2): include_once('C:\xampp\htdocs...') #5
{main} thrown in
C:\xampp\htdocs\googleplus\google-api-php-client\src\io\Google_REST.php on line
66
please any one can help me ..
Original comment by asheesh....@gmail.com
on 7 Nov 2014 at 12:51
Original issue reported on code.google.com by
seyhunca...@gmail.com
on 17 Apr 2012 at 7:11