0
votes

I'm making a little app which manages appointments - I need to know if there's a currently supported way to check if an event overlaps within a google calendar.

Basically I read a list of events from my app's created calendar, and then populate my application using that.

Then, I add a calendar event. I need to check if it conflicts with what already exists. Is there a way to do this with their api?

1

1 Answers

2
votes

The Google calendar api has a method called freebusy it basicly returns a list of events between a two times if they exist within a calendar.

Request events between may 20th and may 25th on my primary calendar.

{
  "timeMax": "2017-05-25T13:44:16.549Z",
  "timeMin": "2017-05-20T13:44:16.549Z",
  "items": [
    {
      "id": "primary"
    }
  ]
}

results

{
 "kind": "calendar#freeBusy",
 "timeMin": "2017-05-20T13:44:16.000Z",
 "timeMax": "2017-05-25T13:44:16.000Z",
 "calendars": {
  "primary": {
   "busy": [
    {
     "start": "2017-05-23T15:35:00Z",
     "end": "2017-05-23T16:35:00Z"
    },
    {
     "start": "2017-05-24T13:00:00Z",
     "end": "2017-05-24T13:30:00Z"
    }
   ]
  }
 }
}