如何在 Google Admin SDK 中委派联系人 Python

How to delegate contacts in Google Admin SDK in Python

我正在尝试将我的 Google 联系人(不是 GMail)委托给另一个帐户(同一个工作区)。 People API does not have the option to delegate contacts so I tried Google Admin SDK - Contact Delegation API。但是,我找不到像其他 API 一样构建资源的方法。

如何创建资源然后委派我的联系人?我需要允许凭证工作的范围是什么?

对于其他 API,我使用此代码:

from googleapiclient.discovery import build
# Load client_config
# Define scopes to autorize like -> scopes = ['https://www.googleapis.com/auth/admin.directory.user']
# Get the credentials into the creds variable

admin_service = build('admin', 'directory_v1', credentials=creds)

# use admin_service to create/update users in the workspace

我的最终目标是使用具有委托访问权限的服务帐户来模拟用户并自动委托 gmail 和联系人。我已经能够让 gmail 委托工作,但不能让联系人委托工作。

我对 Google API 还很陌生,所以我可能忽略了文档中的某些内容。

问题已关闭。它不打算有一个发现文件,因此客户端不能使用它来生成所需的方法。您需要做的是直接调用 REST API。请记住在 headers.

上添加 OAuth 令牌