2016-02-05 44 views
0

我想通过Web API请求更新组设置。提供所有必要的授权范围,并启用组设置。我送一个PUT请求:Google Groups设置API 500错误

body = { 
    "whoCanPostMessage": "ALL_MEMBERS_CAN_POST", 
    "whoCanViewMembership": "ALL_MEMBERS_CAN_VIEW" 
} 
response = requests.put(
    "https://www.googleapis.com/groups/v1/groups/%s" % group_id, 
    data=json.dumps(body), 
    headers={ 
     'Content-type': 'application/json; charset=UTF-8', 
     'Authorization': 'Bearer %s' % access_token 
    } 
) 

但是,服务器的响应:

<Response [500]> Internal Server Error 

headers: 
Cache-Control: private, max-age=0 
Content-Encoding: gzip 
Content-Length: 122 
Content-Type: application/json; charset=UTF-8 
Date: Fri, 05 Feb 2016 18:36:53 GMT 
Expires: Fri, 05 Feb 2016 18:36:53 GMT 
Server: GSE 
Vary: Origin, X-Origin 

content: 
{ 
"error": { 
    "errors": [ 
    { 
    "domain": "global", 
    "reason": "backendError", 
    "message": "Backend Error" 
    } 
    ], 
    "code": 500, 
    "message": "Backend Error" 
} 
} 

,当我使用的群组设置API参考Try It!发生同样的错误。

回答

0

我发现UniqueGroupID字段应该设置为一个组邮箱地址而不是一个组ID。它现在有效。