Reputation: 1
I need some help resolving/debugging an error we are now getting on a script that was working fine until 2012-12-07.
We have a Google App script (comprised of several functions) that is attached to a spreadsheet and enables us to set specific permissions on our Google groups. Until recently this script worked without issue. No code changes have been made to the script. We are now getting error 503 at the point where a fetch occurs [resp = UrlFetchApp.fetch(url, options);
]
For the purposes of posting it to this forum, I have altered the function where the error occurs and changed it so that it can be run standalone and also generates the error. I have replaced the ConsumerKey, ConsumerSecret, and other identifying information. We are fairly confident that the hard coded values (e.g. ConsumerKey) are still valid.
The error we are getting is:
Request failed for returned code 503. Server response: { "error": { "errors": [ { "domain": "global", "reason": "backendError", "message": "Backend Error" } ], "code": 503, "message": "Backend Error" } } (line 85)
Here is the function:
function updateGroup(){
groupSettingsUrl = "https://www.googleapis.com/groups/v1/groups/";
scope = "https://www.googleapis.com/auth/apps.groups.settings";
oAuthConfig = UrlFetchApp.addOAuthService("Groups");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setConsumerKey("?.apps.googleusercontent.com");
oAuthConfig.setConsumerSecret("?");
var options =
{
method : "put",
oAuthServiceName : "Groups",
oAuthUseToken : "always",
payload : '{"defaultMessageDenyNotificationText":"","whoCanJoin":"INVITED_CAN_JOIN","kind":"groupsSettings#groups","id":"[email protected]","customReplyTo":" ","allowWebPosting":"true","description":"Test Admins. Systems List","name":"Test Admins","membersCanPostAsTheGroup":"false","whoCanPostMessage":"ANYONE_CAN_POST","includeInGlobalAddressList":"true","whoCanViewMembership":"ALL_IN_DOMAIN_CAN_VIEW","allowExternalMembers":true,"allowGoogleCommunication":"false","isArchived":false,"showInGroupDirectory":true,"replyTo":"REPLY_TO_IGNORE","archiveOnly":"false","email":"[email protected]","whoCanInvite":"ALL_MANAGERS_CAN_INVITE","sendMessageDenyNotification":"false","spamModerationLevel":"MODERATE","whoCanViewGroup":"ALL_MEMBERS_CAN_VIEW","messageDisplayFont":"DEFAULT_FONT","maxMessageBytes":5242880,"messageModerationLevel":"MODERATE_NONE"}',
contentType: 'application/json'
};
url = groupSettingsUrl+"[email protected]";
var resp;
resp = UrlFetchApp.fetch(url, options);
return "Response " + resp.getResponseCode() + "\n body - " + resp.getContentText();
}
Upvotes: 0
Views: 1731
Reputation: 11
Sorry it's taken so long for me to respond Arun. We are able to successfully use UrlFetchApp.fetch with the method being GET.
Upvotes: 1