Issue with Google Calendar API

642 views
Skip to first unread message

Mathew Omeike

unread,
Feb 6, 2018, 3:54:19 PM2/6/18
to AdWords API Forum
I am trying to fetch my calendar events using the google calendar API. But it is giving me error for `dailyLimitExceededUnreg`. But actually i have full limit available. Please help me to get rid from this error.


    Fatal error: Uncaught exception 'Google_Service_Exception' with message '{ "error": { "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", "extendedHelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." } } ' in /home/grabbanddurando/public_html/gdapp/google-api-php-client-2.2.1/src/Google/Http/REST.php:118 Stack trace: #0 /home/grabbanddurando/public_html/gdapp/google-api-php-client-2.2.1/src/Google/Http/REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #1 [internal function]: Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #2 /home/grabbanddurando/public_html/gdapp/google-api-php-client-2.2.1/src/Google/Task/Runner.php(176): call_ in /home/grabbanddurando/public_html/gdapp/google-api-php-client-2.2.1/src/Google/Http/REST.php on line 118

> Code i am using is:

    define('APPLICATION_NAME', 'Google Calendar API PHP Quickstart');
    define('CREDENTIALS_PATH', 'google-api-php-client-2.2.1/credentials/client_idd.json');
    define('CLIENT_SECRET_PATH', 'google-api-php-client-2.2.1/credentials/client_idd.json');
    define('SCOPES', implode(' ', array(
      Google_Service_Calendar::CALENDAR_READONLY)
    ));
    function getClient() {
        $client = new Google_Client();
        $client->setAuthConfig(CREDENTIALS_PATH);
        $client->setApplicationName(APPLICATION_NAME);
        $client->setScopes(SCOPES);
        return $client;
    }
    
    /**
     * Expands the home directory alias '~' to the full path.
     * @param string $path the path to expand.
     * @return string the expanded path.
     */
    function expandHomeDirectory($path) {
      $homeDirectory = getenv('HOME');
      if (empty($homeDirectory)) {
        $homeDirectory = getenv('HOMEDRIVE') . getenv('HOMEPATH');
      }
      return str_replace('~', realpath($homeDirectory), $path);
    }
    
    // Get the API client and construct the service object.
    $client = getClient();
    //echo "<pre>"; print_r($client); echo "</pre>"; exit;
    $service = new Google_Service_Calendar($client);
    
    $events = $service->events->listEvents('primary');
    
    while(true) {
      foreach ($events->getItems() as $event) {
        echo $event->getSummary();
      }
      $pageToken = $events->getNextPageToken();
      if ($pageToken) {
        $optParams = array('pageToken' => $pageToken);
        $events = $service->events->listEvents('primary', $optParams);
      } else {
        break;
      }
    }
    print_r($events);

Luis Xander Talag (AdWords API Team)

unread,
Feb 6, 2018, 10:07:14 PM2/6/18
to AdWords API Forum
Hi Mathew,

Your concern seems to be not an AdWords API related issue but rather on the Google Calendar API. For proper assistance on your concern, you may post it in the Google Calendar API Forum as they are more equipped to assist you regarding this.

Thanks and regards,
Luis Xander Talag
AdWords API Team
Reply all
Reply to author
Forward
0 new messages