I can access the Google Calendar API just fine after enabling it in the Developer's Console, as explained in this SO post. However, I can't find the Google Calendar Resource API in the list to enable. In spite of this, I have tried to access the Resource API via OAuth 2.0 like how I access the Calendar API, but I get the following error:
Exception in callback of async function: Error: failed [403]
<HTML> <HEAD> <TITLE>You are not authorized to use this API.</TITLE> </HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>You are not authorized to use this API.</H1>
<H2>Error 403</H2> </BODY> </HTML>
How do I get it to work? If you've gotten it to work, please share!
EDIT: To give more details, I am using Meteor JS to POST to the following URL with the headers below:
var xmlContent = "<?xml version='1.0' encoding='utf-8'?>" +
"<atom:entry xmlns:atom='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>" +
"<apps:property name='resourceId' value='"+ resource._id +"'/>" +
"<apps:property name='resourceCommonName' value='"+ resource.resourceName +"'/>" +
"<apps:property name='resourceDescription' value='"+ resource.resourceDescription +"'/>" +
"<apps:property name='resourceType' value='"+ resource.resourceType +"'/>" +
"</atom:entry>";
var url = "https://apps-apis.google.com/a/feeds/calendar/resource/2.0/example.com/";
var id = HTTP.post(url, {
'headers' : {
'Content-Type': 'application/atom+xml',
'Authorization': 'OAuth2 oauth_token=' + admin.services.google.accessToken,
'X-JavaScript-User-Agent': "Google APIs Explorer"
},
'content': xmlContent
}
,
function(error, result) {
if (error) throw error;
});//end HTTP.post