Docusignapi 调用create_信封api时出现无效的_用户ID错误
我正在使用Docusignapi 调用create_信封api时出现无效的_用户ID错误,docusignapi,Docusignapi,我正在使用 token = api_client.request_jwt_user_token(client_id=self.integration_key, user_id=self.user_id, expires_in=3600, oauth_host_name=self.oauth_host_name, private_key_bytes=private_key, scopes=(OAuth.SCOPE_SIGNATURE,
token = api_client.request_jwt_user_token(client_id=self.integration_key, user_id=self.user_id,
expires_in=3600,
oauth_host_name=self.oauth_host_name,
private_key_bytes=private_key,
scopes=(OAuth.SCOPE_SIGNATURE, OAuth.SCOPE_IMPERSONATION))
user_info = api_client.get_user_info(token.access_token)
self.base_path = user_info.accounts[0].base_uri + "/restapi" ## tested with and
#without /restapi same result
为了成功地检索访问令牌,我还成功地获取了基本uri,但是当我使用创建和发送信封时
envelopes_api = EnvelopesApi(self.init_client())
envelopes_api.host = self.base_path #tested by explicitly assigning again and
# without this explicit assignment as well
welcome_letter_env = self._populate_template(template_id, signer_name, signer_email, subject, text_tabs, checkbox_tabs, radio_tabs)
results = envelopes_api.create_envelope(self.account_id, envelope_definition=welcome_letter_env)
我得到无效的用户ID错误。请注意,对于演示帐户,完全相同的代码可以顺利运行。这仅适用于生产帐户。您需要为您的帐户将基本uri设置为正确的值 查看/oauth/userInfo调用的结果 例如:
api_client = ApiClient()
api_client.host = base_path #### Setting the base path
api_client.set_default_header("Authorization", "Bearer " + args["ds_access_token"])
envelope_api = EnvelopesApi(api_client)
results = envelope_api.create_envelope(args["account_id"],
envelope_definition=envelope_definition)
已经这样做了,我调用了api_客户端。获取用户信息(token.access_token)来设置基本路径。我将更新这个问题,使其更加详细。事实证明,这实际上是主要问题,我更新了envelopapi.host,而不是更新了api_client.host@感谢拉里的快速反应。很高兴能帮助@MuhammadShoaib。谢谢你的支票。