INVALID_CONTENT_TYPE with create_envelope_from_document
Closed this issue · 2 comments
jaredmoody commented
This may be related to #57, but I'm getting an INVALID_CONTENT_TYPE
error when calling create_envelope_from_document
, but only when it's the first call on the client.
For example, this fails every time:
client = DocusignRest::Client.new(access_token: token)
client.create_envelope_from_document(
signers: signers,
files: [ { path: '/path/to/my.pdf', name: 'my.pdf' } ]
)
# => {"errorCode"=>"INVALID_CONTENT_TYPE", "message"=>"Content Type specified is not supported."}
But this works every time:
client = DocusignRest::Client.new(access_token: token)
# Making another call first makes this work
client.get_account_id
client.create_envelope_from_document(
signers: signers,
files: [ { path: '/path/to/my.pdf', name: 'my.pdf' } ]
)
# => {"envelopeId"=>"66367318-d662-4f2f-b44f-f1d8b4e47211", "uri"=>"/envelopes/66367318-d662-4f2f-b44f-f1d8b4e47211", "statusDateTime"=>"2017-08-02T00:25:30.9070000Z", "status"=>"created"}
jaredmoody commented
Aha, I just read #27 and it sounds like the bottom example is working specifically because I'm calling get_account_id
.
Since I'm using OAuth2 I thought the access token would be enough but you also need to specify the account id:
client = DocusignRest::Client.new(access_token: token, account_id: account_id)
tommotorefi commented
Cool ok thanks for the followup @jaredmoody .