Google Calendar API view / edit rooms / resources?
Asked Answered
A

3

9

Is there some way with the Google Calendar API to view which rooms have been booked when retrieving a meeting via the API?

Also is there a way to add a room resource to a meeting via the Calendar API?

Andras answered 18/12, 2012 at 22:37 Comment(1)
+1 please post a manageable version of your codePrelude
E
5

The fact that you are using resources with Google calendar tells me that you are a Google Apps for Business/Education user.

If you want a list of resources at your organisation you need to use the Google Apps Calendar Resource API. You can also use this API to create new resources.

If you want to list availability of a calendar resource you need to use the Google Calendar API. You need to query the API using a username that has the appropriate permissions to view the resource calendar. The id of a calendar resource looks like an email address ending in @resource.calendar.google.com

You will also notice that resources are listed amongst your event attendees.


Now the bad news

At the time of writing (October 2013) the Google Apps Calendar Resource API uses Atom/OAuth 1.0a whereas the Google Calendar API version 3 uses JSON/OAuth 2.0.

So that means you currently need to implement two different mechanisms of authentication and two different styles of API, fun eh?

That said since Google are deprecating support for OAuth 1.0a, I'm sure they are beavering away re-writing the Google Apps Calendar Resource API to become JSON/OAuth 2.0 compatible (I may post a question here to ask about that!).

Update

Please see my question for information regarding the lifespan of the Google Apps Calendar Resource API:

Google Apps Calendar Resource API v1 (Atom/OAuth 1.0) likely lifespan?

Enroll answered 24/10, 2013 at 8:7 Comment(4)
How do you enable the Calendar Resource API from the developer's console? I don't see it listedBacteriostat
I would be worried about writing anything new using it as it would appear to have a limited lifespan - that said I believe it is part of the Admin SDK. developers.google.com/admin-sdk/calendar-resource. Also please note it is only available for Google Apps for Business and Education domains.Enroll
After a little bit more digging the API uses the now deprecated OAuth 1.0 developers.google.com/accounts/docs/OAuth_ref and so probably doesn't require enabling in the developers console (it requires instead the OAuth domain key). The scope for access to the API is "apps-apis.google.com/a/feeds/calendar/resource"Enroll
When I click on the OAuth 1.0 link, the page states that it is being deprecated and that we should migrate to OAuth 2.0. Quite confusing. My app needs the Resource feature, so I'll have to bite the bullet and implement it. I've tried using OAuth 2.0, but it doesn't work (#27756451), so I'll now try OAuth 1.0. SighBacteriostat
T
5

I've just tried it out - it works fine (returns array of booked dates for each resource id, eventually if such array is empty - resource is available for you. I'd like to get boolean values, but still..)

So, you need to use following API.

  1. Go to section try it

  2. login using oauth

  3. paste request below (Replace resource ids to existing)

Request code:

{
    "maxResults": 10,
    "timeMin": "2013-11-27T00:00:00+02:00",
    "timeMax": "2013-12-27T23:59:59+02:00",
    "items": [
        {
            "id": "[email protected]"
        },
        {
            "id": "[email protected]"
        },
        {
            "id": "[email protected]"
        }
    ]
}
Tether answered 27/11, 2013 at 14:17 Comment(0)
L
4

Have you tried querying the free/busy information of the resource (https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query)?

You can update a room resource to a meeting by updating the event (https://developers.google.com/google-apps/calendar/v3/reference/events/update).

Hopefully, this gives you some good ideas.

Loiseloiter answered 21/12, 2012 at 18:14 Comment(3)
From the documentation it looks like the query is only for a calendar and not for resourcesWindbound
@Emily, I don't see where you add a room resource in the update link you posted. Can you elaborate?Bacteriostat
In the event resource, there is a field resource. If you try to get a event that has a room booked, you can see something like this: { "resource": true, "displayName": "Room-17", "email": "[email protected]", "responseStatus": "accepted" }Loiseloiter

© 2022 - 2024 — McMap. All rights reserved.