0

In my google calendar I have events back to back:

  • event1 9 a.m - 11 a.m
  • event2 11 a.m - 13 p.m
  • event3 13 p.m - 15 p.m

When I query Freebusy api it retruns one event: 9 a.m - 15 a.m rather than separate events, Why ?

Client post request:

$.post(
  "url",
  function (result) {
    var events = [];
    result.map((event, i) => {
      item = {};
      item["title"] = "SameTextToDisplay";
      item["start"] = event.start;
      item["end"] = event.end;
      events.push(item);
    });
  }
);

My nodejs server function:

calendar.freebusy.query({
  resource: {
    timeMin: TimeMin,
    timeMax: TimeMax,
   timeZone: "America/New_York",
    items: [
      {
        id: "MyCalendarID"
      }
    ]
  }}, (err, resp) => {
    if (err) return console.log('The API returned an error: ' + err);
  res.send(resp.data.calendars[id]);
   });
4

1 回答 1

1

如果您想要一个事件列表,请使用端点event.list

官方文档中有一个关于如何将list端点与 javascript 库一起使用的示例。

于 2020-04-24T23:27:00.850 回答