2012-12-18 76 views
0

我需要一些幫助來解決/調試我們現在正在使用的腳本工作正常的錯誤,直到2012-12-07。使用UrlFetchApp.fetch獲取錯誤503

我們有一個附加到電子表格的Google App腳本(由多個功能組成),使我們能夠在我們的Google羣組上設置特定的權限。直到最近這個腳本沒有問題。沒有對腳本進行任何代碼更改。我們現在在發生提取錯誤的地方出現錯誤503 [resp = UrlFetchApp.fetch(url, options);]

爲了將其發佈到此論壇,我已更改發生錯誤的地方並更改了它,以便它可以獨立運行也會產生錯誤。我已經替換了ConsumerKey,ConsumerSecret和其他識別信息。我們相當確信硬編碼值(例如ConsumerKey)仍然有效。

我們得到的錯誤是:

請求失敗,返回碼503服務器響應:{ 「錯誤」:{ 「錯誤」:[{ 「域」: 「全局」, 「理」 : 「backendError」, 「消息」: 「後端錯誤」}], 「代碼」:503, 「消息」:

這裏的 「後端錯誤」}}(線85)的功能是:

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(); 
} 
+0

是否發生GET(https://developers.google.com/google-apps/groups-settings/manage#GA_group_get_settings)組設置等簡單的GET調用?或者只是在這個特定的PUT調用中發生? –

回答

1

對不起,我需要這麼長時間resp阿德阿倫。我們能夠成功使用UrlFetchApp.fetch,方法是GET。