Documentation Lacking How To Upload PDF to Sending Request Upload URL

  • 1
  • Question
  • Updated 1 month ago

I'm integrating to your
V4 API from our V3 integration On this page: https://api.rightsignature.com/documentation/resources/v1/sending_requests.en.html 

I've made the signing request and got back an upload URL. The documentatino does not state how to PUT the PDF file to the upload URL. Is it a base64 string? Byte[]? Multipart form? I need an example on the request being made to the PUT url to send the report. What headers need to be sent?

I've tried so far uploading my pdf with content-type "application/pdf" and then giving a string in the body of the call which is the base64 string of the bytes of the file and the PDF gets uploaded with a 200 OK response but on the site the PDF just displays as the base64 string inside of the PDF and not the actual PDF.
Photo of David

David

  • 5 Posts
  • 0 Reply Likes
  • unsure

Posted 1 month ago

  • 1
Photo of Saravanan Kannan

Saravanan Kannan, Employee

  • 32 Posts
  • 6 Reply Likes
Hi David,

I am assuming you have done the first step https://api.rightsignature.com/documentation/resources/v1/sending_requests/create.en.html and got a sending request id and upload url in the response. Then the step 2 will be to upload the PDF to the upload url. This is how it is done with php/curl.

Hope this helps:

// STEP 2
$ch = curl_init();
$sr_id = YOUR_SENDING_REQUEST_ID;
$upload_url = YOUR_UPLOAD_URL;

curl_setopt($ch, CURLOPT_URL, $upload_url);
curl_setopt($ch, CURLOPT_PUT, 1);
$file_path_str =YOUR FILE/DOCUMENT PATH;
$fh_res = fopen($file_path_str, 'r');
curl_setopt($ch, CURLOPT_INFILE, $fh_res);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/pdf"));
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file_path_str));

$response = curl_exec($ch);

$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo 'HTTP code: ' . $httpcode;

if (curl_errno($ch)) {
  print "Error: " . curl_error($ch);
}

fclose($fh_res);

Thanks
Saravanan
Photo of David

David

  • 5 Posts
  • 0 Reply Likes
I actually just got it to work with the following in c#

var wc = new WebClient();<br>wc.UploadData(UPLOAD_URL;, "PUT", pdfData);

Where pdfData is the file in a byte[]. The file showed up correctly on rightsignature.
(Edited)