Closed GoogleCodeExporter closed 8 years ago
This is the log :
Fatal error: Uncaught exception 'apiServiceException' with message 'Error
calling POST https://www.googleapis.com/calendar/v3/calendars/primary/events:
(400) Bad Request' in
/home/fadoqst/public_html/jonathanbardo.com/1530/src/io/apiREST.php:86
Stack trace:
#0 /home/fadoqst/public_html/jonathanbardo.com/1530/src/io/apiREST.php(56):
apiREST::decodeHttpResponse(Object(apiHttpRequest))
#1
/home/fadoqst/public_html/jonathanbardo.com/1530/src/service/apiServiceResource.
php(186): apiREST::execute(Object(apiServiceRequest))
#2
/home/fadoqst/public_html/jonathanbardo.com/1530/src/contrib/apiCalendarService.
php(493): apiServiceResource->__call('insert', Array)
#3 /home/fadoqst/public_html/jonathanbardo.com/1530/index.php(63):
EventsServiceResource->insert('primary', Object(Event))
#4 {main}
thrown in /home/fadoqst/public_html/jonathanbardo.com/1530/src/io/apiREST.php on line 86<br />
Original comment by bardo.jo...@gmail.com
on 25 Feb 2012 at 1:53
Hi ,
I too am facing the same Fatal Error:
When i am trying to add a event to google calender .
Below is the code i used:
require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiCalendarService.php';
session_start();
$client = new apiClient();
$client->setApplicationName("Google Calendar PHP Starter Application");
// Visit https://code.google.com/apis/console?api=calendar to generate your
// client id, client secret, and to register your redirect uri.
$client->setClientId('');
$client->setClientSecret('');
$client->setRedirectUri('');
$client->setDeveloperKey('');
//$apiClient = new apiClient();
//$client->setUseObjects(true);
//$client->useObject(true);
//$service = new apiCalendarService($client);
$cal = new apiCalendarService($client);
if (isset($_GET['logout'])) {
unset($_SESSION['token']);
}
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
$authUrl = $client->createAuthUrl();
if ($client->getAccessToken()) {
$calList = $cal->calendarList->listCalendarList();
print "<h1>Calendar List</h1><pre>" . print_r($calList, true) . "</pre>";
$event = new Event();
$event->setSummary('Appointment');
$event->setLocation('Somewhere');
$start = new EventDateTime();
$start->setDateTime('2012-08-06T10:00:00.000-07:00');
$event->setStart($start);
$end = new EventDateTime();
$end->setDateTime('2011-08-06T10:25:00.000-07:00');
$event->setEnd($end);
$attendee1 = new EventAttendee();
$attendee1->setEmail('sashadabit@gmail.com');
// ...
$attendees = array($attendee1
// ...
);
$event->attendees = $attendees;
$createdEvent = $cal->events->insert('primary', $event);
echo $createdEvent->getId();
$_SESSION['token'] = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
print "<a class='login' href='$authUrl'>Connect Me!</a>";
}
Original comment by alishada...@gmail.com
on 6 Aug 2012 at 10:34
Please reopen if this issue is still occurring!
Original comment by ianbar...@google.com
on 22 Mar 2013 at 1:51
Please reopen this issue, its the same case with alishada...@gmail.com, how did
he fix it?
I've tested it on version 0.6.0-0.6.2 but the same 400 bad re-guest:
.... Fatal error: Uncaught exception 'Google_ServiceException' with message
'Error calling POST ..................thrown in
/home/emaster/public_html/work/google-api-php-client/src/io/Google_REST.php on
line 66....
Moreover please someone update the info on
https://developers.google.com/google-apps/calendar/v3/reference/events/insert?hl
=el
the example code there:
$event = new Event(); should become ---> new Google_Event(); or not?
Original comment by xstefani...@gmail.com
on 14 Apr 2013 at 3:42
You may want to post your issue on the Calendar API group for faster
resolution,
https://groups.google.com/forum/embed/?place=forum/google-calendar-api - our
focus on this tracker is library specific issues (which this may be!)
Original comment by ianbar...@google.com
on 15 Apr 2013 at 9:32
Issue 303 has been merged into this issue.
Original comment by ianbar...@google.com
on 15 Apr 2013 at 9:32
This issue tracker is now closing. Development on the Google PHP client library
moved to GitHub with the release of the 1.0.0-alpha, and now the 1.0 branch has
reached beta status there will be no further releases of the 0.6 branch of the
library.
Please take a look at the latest version on
https://github.com/google/google-api-php-client
For information on migrating, please take a look at this guide:
https://developers.google.com/api-client-library/php/guide/migration
For general library support please ask a question on StackOverflow:
http://stackoverflow.com/questions/tagged/google-api-php-client
If you are looking for support with a specific API, please contact the team
working with that API via StackOverflow or their preferred support mechanism.
If your issue still exists with the new version of the library, please raise a
bug in the GitHub issue tracker with a minimal code sample.
Thanks!
Original comment by ianbar...@google.com
on 22 Jan 2014 at 4:53
Original issue reported on code.google.com by
bardo.jo...@gmail.com
on 25 Feb 2012 at 1:52