title: Getting Error 503 with UrlFetchApp.fetch
body: <p>I need some help resolving/debugging an error we are now getting on a script that was working fine until 2012-12-07.</p>
  
  <p>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 [<code>resp = UrlFetchApp.fetch(url, options);</code>] </p>
  
  <p>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. </p>
  
  <p>The error we are getting is: </p>
  
  <blockquote>
    <p>Request failed for returned code 503. Server response: { "error": { "errors": [ { "domain": "global", "reason": "backendError", "message": "Backend Error" } ], "code": 503, "message": "Backend Error" } } (line 85)</p>
  </blockquote>
  
  <p>Here is the function:</p>
  
  <pre><code>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":"testadmins@TST.com","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":"testadmins@TST.com","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+"testadmins@TST.com"; 
  
    var resp;
    resp = UrlFetchApp.fetch(url, options);
  
    return "Response " + resp.getResponseCode() + "\n body - " + resp.getContentText();
  }
  </code></pre>