Google calendar API - check for conflicts - google-api

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?

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"
}
]
}
}
}

Related

Can I create extended properties in Google People API and Task API?

I have added an extended property to a Google calendar entry and been able to read it back successfully. The format of the json is like this:
"extendedProperties": {
"private": {
"MyPropertyName": "yes"
}
},
I want to do the same thing to created Task entries and contact entries (via the People API). With the People API, trying to create the entry results in http 400. With the Task API, it accepts the json, but the property is not returned when I retrieve the task.
Is it possible to do what I want with the current versions of the People and Task API?
In People API extended properties are called ClientData
The json structure of the resouce is:
{
"metadata": {
object (FieldMetadata)
},
"key": string,
"value": string
}
with FieldMetadata:
{
"primary": boolean,
"sourcePrimary": boolean,
"verified": boolean,
"source": {
object (Source)
}
}

How can I disable waiting room in Google Meets created with calendar api?

In the Google Calendar api there's the ability to request that a conferencing link be created when an event is created.
My current setup is that I have an account that is creating google calendar events whenever someone schedules a meeting on my app. The problem is that when someone outside of my organization tries to join the meeting it says "ask to join" which isn't possible since nobody from my organization will be in the meeing. Are there are parameters to let me turn off the waiting room feature or at least have a list of approved emails that are allowed to enter the meeting. The request body looks like this right now:
{
"end": {
"dateTime": "2020-08-30T05:27:35.206Z"
},
"start": {
"dateTime": "2020-08-29T05:27:35.206Z"
},
"conferenceData": {
"createRequest": {
"conferenceSolutionKey": {
"type": "hangoutsMeet"
},
"requestId": "12345"
}
},
"summary": "Test event with meets 2",
"attendees": [
{
"email": "****#gmail.com"
}
]
}
The attendee I added still has to request to join the meeting.
This appears to be a bug!
I have taken the liberty of reporting this on Google's Issue Tracker for you, detailing the behaviour:
User from outside of G Suite domain required to ask to join a Meeting from a Calendar event they are invited to
You can hit the ☆ next to the issue number in the top left on the page which lets Google know more people are encountering this and so it is more likely to be seen to faster.

Getting excluded dates from recurrent events through Microsoft Outlook Calendar API

I am creating an event with recurrence in Outlook Calendar and want to retrieve its full specification through API.
For example, the event repeats every weekend for a year.
However, I removed some of the weekends from the time line, creating an exception to a recurrence rule.
How can I get these excluded dates through the API? When I receive a response with events from Outlook Calendar API I can not find an entry with excluded days.
Response with recurrence from Outlook Calendar API:
"recurrence": {
"pattern": {
"type": "weekly",
"interval": 1,
"month": 0,
"dayOfMonth": 0,
"daysOfWeek": [
"saturday",
"sunday"
],
"firstDayOfWeek": "monday",
"index": "first"
},
"range": {
"type": "endDate",
"startDate": "2017-08-19",
"endDate": "2018-01-30",
"recurrenceTimeZone": "FLE Standard Time",
"numberOfOccurrences": 0
}
},
On the event object, there's a type property that has values including SingleInstance, Occurrence, Exception and SeriesMaster.
If you have the event ID of the series, you should be able to query exceptions like this:
https://graph.microsoft.com/v1.0/me/events/[series id]/instances?startdatetime=2017-08-14T16:35:08.284Z&enddatetime=2017-08-18T16:35:08.284Z&$filter=type eq 'Exception'
According to the docs for listing event instances, this returns "occurrences and exceptions of the event in the specified time range".
Update: This might not actually work. I'm testing this now and the call returns a 200 status code, but an empty array of event exceptions. I'll investigate and update this when I learn more.

What services can I use to fetch an image of a person based on their email address, without authentication

I know gravatar allows this, and I'd like to look into facebook, google plus, twitter, instagram, and anything else.
Do you guys know of any services like this?
EDIT: to clarify, by "without authentication" do I mean user authentication, I expect to use some sort of API
One possible approach, using Facebook Graph Api would be to perform a search against the name for users objects and also retrieve their pictures, using API version 2.2 it would be a call like:
GET graph.facebook.com
/search?q=miles davis&type=user&fields=id,name,picture
This would retrieve id, name and picture object for a search on miles davis, first results as example:
{
"data": [
{
"id": "805353876185303",
"name": "Miles Davis",
"picture": {
"data": {
"is_silhouette": true,
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/v/t1.0-1/c15.0.50.50/p50x50/10354686_10150004552801856_220367501106153455_n.jpg?oh=XXXXXXXXXXXXXXXX&oe=XXXXXX&__gda__=XXXXXXX_XXXXXXXXXXXXX"
}
}
},
{
"id": "1572370603017419",
"name": "Miles Davis",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p50x50/1501761_1382020035385811_1384168153_n.jpg?oh=XXXXXXXXX&oe=XXXXXXXXXXX&__gda__=XXXXXX_XXXXXX"
}
}
}, ...........
The field is_silhouette is false if the user has a profile picure.

Pull public event data from Google Calendar

I may be over thinking this a bit. On my web site, I would like to user certain data from my public google calendar. My plan is to pull it on the server side so I can do things like process it, cache it and format it the way I want.
I've been looking at using the Google Api libraries, but I can't get past any of the authorization hurdles. A service account sounds like what I really want, but I'm having trouble wrapping my head around how that works in this situation.
The old GDATA apis would be ok, but I'm not very keen on using them because they look fairly deprecated at this point by the newer libraries.
Since it is all public data, I'm hoping there is a simpler way to get to the event data that I'm looking for.
In case it matters, my site is Asp.Net (MVC).
Update
Ok, I was definitely way over thinking it. See my answer.
Now that RSS has been removed from Google Calendar, I've been in search of an easy replacement. I dug around and found the following in the Google Calendar API that seems to do the trick: calendar.events.list
Calendar Events List in Google API Explorer is a good place to get started with the different parameters and options - and it'll build you an example request string. You can see that I specified a minimum time of 2/5/2016, sort it by the start time, and show deleted events.
GET https://www.googleapis.com/calendar/v3/calendars/[CALENDAR ID HERE]/events?
orderBy=startTime&showDeleted=true&singleEvents=true&
timeMin=2016-02-05T00%3A00%3A00Z&key={YOUR_API_KEY}
Results are in JSON so you can parse it in your favorite programming language, ASP.NET or whatever. Result looks like:
{
"kind": "calendar#events",
"etag": "\"123456789123456\"",
"summary": "My Public Calendar",
"updated": "2016-01-29T14:38:29.392Z",
"timeZone": "America/New_York",
"accessRole": "reader",
"defaultReminders": [ ],
"items": [ {
"kind": "calendar#event",
"etag": "\"9876543210987654\"",
"id": "sfdljgsdkjgheakrht4sfdjfscd",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=sdgtukhysrih489759sdkjfhwseihty7934hyt94hdorujt3q95uy689u9yhfdgnbiwe5hy",
"created": "2015-07-06T16:21:59.000Z",
"updated": "2015-07-06T16:21:59.329Z",
"summary": "In-Service Day",
"location": "Maui, HI",
"creator": {
"email": "abra#cadabra.com",
"displayName": "Joe Abra"
},
"organizer": {
"email": "cadabra.com_sejhrgtuiwerghwi4hruh#group.calendar.google.com",
"displayName": "My Public Calendar",
"self": true
},
"start": {
"date": "2016-02-08"
},
"end": {
"date": "2016-02-09"
},
"transparency": "transparent",
"iCalUID": "isdt56y784g78ty86tgsfdgh#google.com",
"sequence": 0
},
{
...
}]
}
One good answer to this (the one I'm going with) is to simply use the calendar's public address to get the data. This is an option that I had forgotten about and it works fine for this particular situation.
You can find the url for the data if you go to the settings for a particular calendar and pick the format you want (I went with xml for this situation.)
The data that you get out of this service is very human-reader optimized, but I can make it work for what I'm doing.

Resources