Krzysztof Wolny
Krzysztof Wolny

Reputation: 11086

How can I get a list of calendar resources via Google API

I try to use fetch list of Calendar Resources (https://support.google.com/a/answer/60766?hl=en) from my company's Google Apps, using Google API. I try to use it using OAuth 2.0 Playground page (https://developers.google.com/oauthplayground). What I do:
1. I select scope & authorize API with my company's admin account and using this scope https://apps-apis.google.com/a/feeds/calendar/resource/
2. I xchange authorization code for tokens
3. I put a requested URL: https://apps-apis.google.com/a/feeds/calendar/resource/2.0/my-company-domain-url/
4. I send request and I get error:

HTTP/1.1 403 Forbidden
Alternate-protocol: 443:quic,p=1
Content-length: 207
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: Fri, 18 Dec 2015 22:09:43 GMT
Server: GSE
-content-encoding: gzip
Cache-control: private, max-age=0
Date: Fri, 18 Dec 2015 22:09:43 GMT
X-frame-options: SAMEORIGIN
Alt-svc: quic=":443"; ma=604800; v="30,29,28,27,26,25"
Content-type: text/html; charset=UTF-8
<HTML>
<HEAD>
<TITLE>You are not authorized to access this API.</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>You are not authorized to access this API.</H1>
<H2>Error 403</H2>
</BODY>
</HTML>

I've already enabled this API in Developers Console.

Question: what else do I need to do to make it work, i.e. be able to fetch calendar resources list?

Upvotes: 4

Views: 2135

Answers (2)

Radu Stoia
Radu Stoia

Reputation: 30

You might want to try this link, https://developers.google.com/google-apps/calendar/v3/reference/acl/list.

This should give you a list of resources.

Here is a link for the Overview info, https://developers.google.com/google-apps/calendar/v3/reference/acl.

I hope it helps.

Upvotes: -1

Krzysztof Wolny
Krzysztof Wolny

Reputation: 11086

I was simply missing the enabled flag for Administrative API access, described here:

https://support.google.com/a/answer/60757?hl=en

second thing, more obvious is that only domain admins have access to this API.

Additionally, I've just found that in version 1.21 of Admin-SDK Java Client library (com.google.apis:google-api-services-admin-directory) Google added support for Calendar Resources! So all you need to do now is:

Directory.resources().calendars().list("my_customer").execute();

The scope is new: https://www.googleapis.com/auth/admin.directory.resource.calendar so one needs to authorize it API in Google Apps Admin console.

Upvotes: 2

Related Questions