Subject: | requestSignatureFromDocument giving "415 Unsupported Media Type" error |
Date: | Sat, 22 Apr 2017 17:43:20 +0200 |
To: | <bug-Document-eSign-Docusign [...] rt.cpan.org> |
From: | "Jon Leigh" <jonleigh1960 [...] gmail.com> |
Module version/distribution:
I am running the very latest distribution, installed from CPAN today:
Document::eSign::Docusign 0.06.
Perl version:
perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Operating System vendor and version (by running the command uname -a) :
Linux 404494-web1.portology.com 2.6.32-431.29.2.el6.x86_64 #1 SMP Sun Jul 27
15:55:46 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
ERROR MESSAGE :
The hashref returned, when converted to json, is as
follows:- {"error":"415 Unsupported Media Type"}
First of all, I know that the PDF document I am trying to send is FINE
because I have sent it successfully using the API Explorer in the Docusign
Sandbox.
The following code gives the error (and note that if I try removing anything
from the baseUrl then it gives an error!) :
Notes:
1. Anything like <this> is a note e.g. obviously I've not shown my
password
2. I've also amended the Integrator Key
3. hash_to_json is a callable subroutine I have written to display
$response as json.
-----------------
use Document::eSign::Docusign;
my $html='';
my $ds = Document::eSign::Docusign->new(
baseUrl =>
'https://demo.docusign.net/restApi/v2/accounts/<7-digit A/C No>/envelopes',
username => '<my_email_address>',
password => '<my password>',
integratorkey => 'b094xxxx-855f-1x11-a929-xxxxxxxxxxxx'
);
&requestSignatureFromDocument;
print "Content-type: text/html\n\n";
print '<html><body>';
print $html;
print '</body></html>';
exit;
#########################################
sub requestSignatureFromDocument {
my $response = $ds->requestSignatureFromDocument ( {
emailSubject => "You have a Document to sign
",
emailBlurb => "Please sign my document",
documents => [ {
documentId =>
"1",
name =>
"/var/www/path/to/my/doc/PARTICIP_62386082.pdf"
}
],
recipients => {
signers => [
{
email =>
"<signer email address>",
name =>
"<signer name>",
recipientId
=> "1",
tabs => {
signHereTabs => [
{
xPosition => "100",
yPosition => "100",
documentId => "1",
pageNumber => "1"
}
]
}
}
]
},
status => "sent"
}
);
$html='<p>Response
JSON:<br><br>'.hash_to_json($response).'</p>';
}
-----------------
I can't help noticing that the `sendRequest` sub-module does not include any
conversion to base64 - which the API seems to demand - nor does it include
the statement `Content-Transfer-Encoding: Base64` - see
http://stackoverflow.com/questions/28839919/docusign-api-format-conversion-e
rror
I've been going round in circles on this all day.
Jon Leigh
Message body is not shown because it is too large.