Reputation: 53
I am getting 302 when I try to do something with docusign-ruby-client.
envelope_args = {
signer_email: '[email protected]',
signer_name: 'Name',
cc_email: '[email protected]',
cc_name: 'Another name',
template_id: 'template-id'
}
args = {
client_id: 'my-client-id',
impersonated_user_guid: 'my-impersonated-user-guid',
base_path: 'account-d.docusign.com',
envelope_args: envelope_args
}
envelope_args = args[:envelope_args]
configuration = DocuSign_eSign::Configuration.new
configuration.host = args[:base_path]
path = File.join(File.dirname(File.absolute_path(__FILE__)), 'private-key.txt')
private_key = File.read(path)
api_client = DocuSign_eSign::ApiClient.new configuration
api_client.set_oauth_base_path(args[:base_path])
token = api_client.request_jwt_user_token(args[:client_id], args[:impersonated_user_guid], private_key, 3600)
user_info = api_client.get_user_info(token.access_token)
template_api = DocuSign_eSign::TemplatesApi.new(api_client)
template_api.list_templates(user_info.accounts.first.account_id)
I created an JWT integration key, also authorized my user/ app and I see that I have an user_info.accounts.first.account_id
when I execute user_info = api_client.get_user_info(token.access_token)
.
When I try to execute any api.list_something
I receive:
302
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://account-d.docusign.com/">here</a>.</h2>
</body></html>
Upvotes: 2
Views: 203
Reputation: 49114
I agree with @anothermh. Try setting your api_client's base path:
api_client.config.host = 'https://demo.docusign.net/restapi'
The above base path is for demo (the developer sandbox).
For production, you need to pull the base path out of the get_user_info
response.
Upvotes: 1