Getting document for signing from S3 - docusignapi

I have documents stored in S3 and would like to send them to docusign via REST API. I am using ruby and the standard net/http library (or Faraday, or docusign_rest gem). When sending fromS3 I am getting an error:
{
"errorCode": "NO_DOCUMENT_RECEIVED",
"message": "The document element did not contain the encoded document, or there is a problem with the encoding. Bytes for document corresponding to documentId 13 not found in request. 'documentId=<x>' possibly missing from Content-Disposition header."
}
I am hosting on Heroku so no local storage access.
Here is some relevant code...
remote_file = Faraday.get(document.filepicker_policy_url)
This retrieves the document from S3, then
post_body << remote_file.body
This should add it to the multi-part post.

You should use a ruby tempfile, and then upload from there

Related

Issues uploading file to Microsoft Form Recognizer

I'm having some trouble while trying to send a PDF file to Microsoft's Form Recognizer service.
Instead of sending the PDF Url location, I need to send the PDF file. On my experience, sending files could be done using base64 but it seems that Microsoft service is not compatible with base64 format. Whenever I try sending the file the server responses:
{
"error": {
"code": "1000",
"message": "Invalid input file."
}
}
I need to know how I should convert my PDF to the required application/pdf "Binary PDF data". I can't find any documentation referring to this conversion.
The Form Recognizer API webpage is: https://brazilsouth.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-1-preview-3/operations/AnalyzeWithCustomForm
And here you can find the complete documentation webpage: https://learn.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/client-library?tabs=preview%2Cv2-1&pivots=programming-language-rest-api
Thanks!
You are correct that base64-encoded requests are not supported.
If you are using curl and you want to send a local file, run this:
curl -i https://{endpoint}/formrecognizer/v2.1-preview.3/custom/models/{modelId}/analyze -H 'Content-Type: application/pdf' \
-H 'Ocp-Apim-Subscription-Key: {subscription key}' --data-binary #/path/to/your/file.pdf
The key parts are the Content-Type header, which must match a supported value, and the --data-binary flag, which is the path to a local PDF file. Be sure to include the -i flag so that you can see the Operation-Location header in the response, which is where you can retrieve the analyze results.
You may also want to take a look at the Form Recognizer SDKs for C#, Java, JavaScript, and Python.

while signing the pdf it returns Error UNABLE_TO_LOAD_DOCUMENT

while loading pdf in docusign API in order to sign the pdf file, it gives error "Unable to load the document.". I am attaching the pdf for reference.
full error message is as below from API:
<errorDetails xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<errorCode>UNABLE_TO_LOAD_DOCUMENT</errorCode>
<message>Unable to load the document. Unable to load Document(1;
Retail AMP - Pexe CO-1 MM Piza Hut-RDE-CC21.pdf). Error: Expected Base.String</message>
</errorDetails>
Please find below Docusign link for reference:
https://support.docusign.com/en/cases/05599635
Thanks.
There are two ways to send documents to DocuSign via the API:
You can use Base64 encoding, which means you serialize the document into a very long string. If you used this method - please ensure that you correctly sereaized the document and that the string you send in the API call, is inedeed a correct string representing a base64 PDF.
You can send it as a binary transfer, this more efficient and less popular mean of uploading documents via the API. You can find out how to do this and see an example of code to upload files:
https://developers.docusign.com/esign-rest-api/code-examples/code-example-send-binary

DocuSign: Unable to upload pdf Document via API

I'm trying to create a new envelope via api, but getting the following error message:
<errorDetails xmlns=""http://www.docusign.com/restapi"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"">
<errorCode>UNABLE_TO_LOAD_DOCUMENT</errorCode>
<message>Unable to load the document. Unable to load Document(XXXXX.pdf).
Error: Value must be non negative. & vbLf & "Parameter name: Height</message>
</errorDetails>
Could you help with the problem? Not sure why it's happening.
Since the PDF worked when you uploaded it to DocuSign via the DocuSign web tool, the problem lies in how you uploaded it via the API.
When uploading via the API:
Set the fileExtension attribute to "pdf" or whatever the source format is. Eg "html", "docx", etc.
Set the documentBase64 attribute to the BASE64 encoded value of your source document.
I suggest you examine the code example for your preferred language to see how this is done:
C#,
PHP,
Java,
Node.js,
Python,
Ruby,
Curl (direct API)
Look at how scenario 1 or 2 reads and then uploads the source document to DocuSign.
If your document is larger than 15MBytes or so, you may want to upload to DocuSign using a binary transfer technique. To do so, see the examples' scenario number 10.

Retrieve signed document using DocuSign API

I want to download a document signed recipient using DocuSign API (REST).
I am using the following endpoint as per the documentation.
HTTP request
GET /v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}
Request Headers
X-DocuSign-Authentication:{"Username": <Username>,"Password": <Password>,"IntegratorKey": <IntegratorKey>}
Accept: application/pdf
Content-Transfer-Encoding:base64
I got document in a base64 format which I am able to download but when try to open that file using PDF viewer we got the following message:
The file is blank and some error related to signature, check following screenshot
PDF open error snapshot
Are there any parameters missing while downloading the document? Please help.
Thanks.
See this link for EnvelopeId stamp control
https://support.docusign.com/en/articles/How-do-I-move-the-Envelope-ID-Stamp-on-my-documents
In DEMO environment you will always have the "demonstration only" stamp on the document. This will not be present when you goto prod environment

File not supported error while uploading profile image file to IBM Connections using REST API

I'm trying to upload a jpeg file for profile image using the Profiles REST API to IBM Connections_v5.0. I however get an error message "The type of the photo file you provided is not supported".
I'm however able to upload the same file directly using the Connections UI interface directly. I'm setting the MIME type correctly as "image/jpeg".
Also tried with GIF and PNG images but get the same error message.
Any pointers would be very helpful.
I'm just using FF restclient addon to fire a REST call. So basically doing a PUT on /profiles/photo.do?key=....
Content-Type is set as "image/jpeg" and the payload consists of the image data in binary (base 64) encoded.
The payload should just be the binary of the image, there is no need to Base64 encode it.
You should refer to Adding a Profile Photo
You need to use a Key (great stackoverflow post here)
If you know the key for a user's profile you can do the following:
key — This is generated by Connections itself during the population
process. It is used to define the users profile within the context of
Profiles and provides Connections with the ability to associate
content with a user when the users LDAP information has been altered.
It provides a separation of identity and helps facilitate user content
synchronization for Connections.
Once you have a key, you make the following request
URL: https://profiles.enterprise.example.com/profiles/photo.do?key=
b559403a-9r32-2c81-c99w-ppq8bb69442
METHOD: PUT
CONTENT-TYPE: image/png
input the binary content on the stream
you should be able to use "image/jpeg", "image/jpg", "image/png" or "image/gif"
If you have an error after the PUT method, you should add the SystemOut.log lines which are relevant.

Resources