4

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?

Krzysztof Wolny
  • 10,576
  • 4
  • 34
  • 46
  • Do I have to use an admin account on oathplayground to authorize this scope? Actually, I got `This app is blocked` after selecting my account existing on the desired organization but not admin. – Benyamin Jafari Oct 20 '22 at 06:20
  • I found out I should have added playground as an allowed third-party app on google admin according to [this procedure](https://support.claralabs.com/article/132-how-do-i-fix-this-app-is-blocked-error-message-when-authorizing-clara-app-to-access-my-calendar) – Benyamin Jafari Oct 20 '22 at 11:05

2 Answers2

2

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.

Krzysztof Wolny
  • 10,576
  • 4
  • 34
  • 46
-1

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.

Radu Stoia
  • 30
  • 3
  • I don't think this is about Calendar Resources, it's rather about ACL (Access Control List). Calendar Resources API it's part of Admin API https://developers.google.com/admin-sdk/calendar-resource/ – Krzysztof Wolny Dec 24 '15 at 07:58