Google保险柜API HttpError 500“遇到内部错误。”

时间:2018-10-08 20:35:12

标签: google-api google-api-client

尝试使用Google Vault API创建保全时出现以下错误:

  

请求时出现HttpError 500   https://vault.googleapis.com/v1/matters/ {matterId} / holds?alt = json   返回“遇到内部错误。”

from google.oauth2 import service_account
import googleapiclient.discovery

SCOPES = ['https://www.googleapis.com/auth/ediscovery']
SERVICE_ACCOUNT_FILE = './serviceaccount.json'
credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
delegated_credentials = credentials.with_subject('delegateuser@example.com')
client = googleapiclient.discovery.build('vault', 'v1', credentials=delegated_credentials)

data = { 'name': 'test', 'accounts': [{'email': 'testuser@example.com' }], 'corpus': 'MAIL', 'query': { 'mailQuery': {'terms': 'to:ceo@company.com'} }}

results = client.matters().holds().create(matterId='{matterId}', body=data).execute()

我已经用{matterId}替换了实际的subjectId字符串。 创建事务,列出事务和列出保持工作就可以了。 我尝试了将不同的字段组合包含在请求正文中,但是文档尚不清楚哪些是必需的...

2 个答案:

答案 0 :(得分:0)

事实证明,您不能在hold()。create()中使用“电子邮件”-您必须使用accountId或gmail用户的“ id”号。

答案 1 :(得分:0)

相关问题