title: Why does google calendar API v3 PHP throw this error when posting to calendar but not when getting info?
body: <p>I'm attempting to use the Google Calendar API version3 (PHP) to manage calendars.</p>
  
  <p>I <strong>can</strong> easily <strong>retrieve</strong> information regarding a calendar such as calendar names and calendar lists, but I am <strong>unsuccessful in actually 'writing'</strong> to a calendar such as adding events or creating a secondary calendar. I always receive the following error in my attempt. </p>
  
  <p>Anybody out there that can help? I have looked everywhere in Google's documentation but can't find any answers.</p>
  
  <p>The error (if trying to post, not retrieve info):</p>
  
  <p>Fatal error: Uncaught exception 'apiServiceException' with message 'Error calling POST <a href="https://www.googleapis.com/calendar/v3/calendars?key=eyfheufheuwehwi" rel="nofollow">https://www.googleapis.com/calendar/v3/calendars?key=eyfheufheuwehwi</a>: (400) Invalid Value' in /home/incs/google-api-php-client/src/io/apiREST.php:86 Stack trace: #0 /home/incs/google-api-php-client/src/io/apiREST.php(56): apiREST::decodeHttpResponse(Object(apiHttpRequest)) #1 /home/incs/google-api-php-client/src/service/apiServiceResource.php(187): apiREST::execute(Object(apiServiceRequest)) #2 /home/incs/google-api-php-client/src/contrib/apiCalendarService.php(228): apiServiceResource->__call('insert', Array) #3 /home/public_html/gateway/google/index.php(130): CalendarsServiceResource->insert(Object(Calendar)) #4 {main} thrown in /home/incs/google-api-php-client/src/io/apiREST.php on line 86</p>
  
  <p>the code (by the way my access keys are set in the config.php hence the commented $client lines)</p>
  
  <pre><code>require("/home/incs/google-api-php-client/src/apiClient.php");
  require("/home/incs/google-api-php-client/src/contrib/apiCalendarService.php");
  session_start();
  
  $client = new apiClient();
  $client-&gt;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-&gt;setClientId('insert_your_oauth2_client_id');
  // $client-&gt;setClientSecret('insert_your_oauth2_client_secret');
  // $client-&gt;setRedirectUri('insert_your_oauth2_redirect_uri');
  // $client-&gt;setDeveloperKey('insert_your_developer_key');
  $service = new apiCalendarService($client);
  if (isset($_GET['logout'])) 
  {
    unset($_SESSION['token']);
  }
  
  if (isset($_GET['code'])) 
  {
    $client-&gt;authenticate();
    $_SESSION['token'] = $client-&gt;getAccessToken();
    header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
  }
  
  if (isset($_SESSION['token'])) 
  {
    $client-&gt;setAccessToken($_SESSION['token']);
  }
  
  if ($client-&gt;getAccessToken()) 
  {
  
    $calendar = new Calendar();
    $calendar-&gt;setSummary('calendarSummary');
    $calendar-&gt;setTimeZone('American/Los_Angeles');
  
    $createdCalendar = $service-&gt;calendars-&gt;insert($calendar);
  
  
    $calList = $service-&gt;calendarList-&gt;listCalendarList();
    print "&lt;h1&gt;Calendar List&lt;/h1&gt;&lt;pre&gt;" . print_r($calList, true) . "&lt;/pre&gt;";
  
  
    $_SESSION['token'] = $client-&gt;getAccessToken();
  } 
  else 
  {
    $authUrl = $client-&gt;createAuthUrl();
    print "&lt;a class='login' href='$authUrl'&gt;Connect Me!&lt;/a&gt;";
  }
  </code></pre>