question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example of API docs lists all events

See original GitHub issue

Hello all,

I’ve tried to implement the calendar API with a simple nodejs server. I just copied the quickstart exmaple form here: Google Calendara Node Quickstart

It all works fine, besides the issue, that I can’t filter any events. Instead of receiving only requested events the API lists all events in calendar:

function listEvents(auth) {
  var calendar = google.calendar('v3');
  calendar.events.list({
    auth: auth,
    calendarId: 'primary',
    timeMin: (new Date()).toISOString(),
    maxResults: 10,
    singleEvents: true,
    orderBy: 'startTime'
  }, function(err, response) {
    if (err) {
      console.log('The API returned an error: ' + err);
      return;
    }
    var events = response.items;
    if (events.length == 0) {
      console.log('No upcoming events found.');
    } else {
      console.log('Upcoming 10 events:');
      for (var i = 0; i < events.length; i++) {
        var event = events[i];
        var start = event.start.dateTime || event.start.date;
        console.log('%s - %s', start, event.summary);
      }
    }
  });
}

AS response I get every single calendar entry (currently 63 items from 2014 till end of 2018). So either timeMin nor maxresults have any effect on the query… I’m doing something wrong? I currently only tested it local but it should work in debug mode as well, or?

Environment: Windows 10 Node: V8.9.2

Any tips? Or is this just a bug. To check it again, I’ve set up a new nodejs project which only contains the quickstart example file. But same result

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
uskithubcommented, Jan 25, 2018

Use those versions and change a little something like below.

npm install googleapis@25.0.0 --save npm install google-auth-library@1.0.0 --save

let google = require('googleapis');
let OAuth2 = google.auth.OAuth2;
let oauth2Client = new OAuth2(clientId, clientSecret, redirectUrl);
let events = response.data.items;
0reactions
JustinBeckwithcommented, Mar 8, 2018

Yeah - for others that fall into this, the trick is to not install your own version of google-auth-library. That quickstart had some really bad advice. Just install googleapis, and it will bring it’s own copy of google-auth-library along with it 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stripe API reference – List all events – curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries....
Read more >
Events: list | Google Calendar
Parameter name, Value, Description. Path parameters. calendarId, string, Calendar identifier. To retrieve calendar IDs call the calendarList.list method.
Read more >
List all Events - Optimizely
Get all Events for a Project. This endpoint lists all types of Events including Pageview Events which are stored as Pages. You can...
Read more >
List Content Events - HubSpot API
Field name Type Description id string The unique id of the task portalId string The hub id campaignGuid string value of campaign GUID associated with Content...
Read more >
Events APIs (Free Tutorials, SDKs, API Keys, Documentation ...
They differ from event-driven APIs, which are triggered based on an action. For example, a notification that someone liked a post on Facebook...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found