I am at this site : https://www.free-ocr.com/ which allows you to upload a file and in response returns text from that file.
When I upload a file it creates a POST request with multi-part form data with the following headers.
In return it gets the folowing response, the one in which I am interested :
However, when I try to replicate this whole thing in POSTMAN using POST method and upload a file using form-data, I do not get the same response as it was intended. Can somebody help me sort out what am I doing wrong?
you just need to select type as file in body
then select the file .
Related
I want to send image file along with various data.
The issue is when i send file using formdata/multipart the body data comes in string. So my dto is giving error.
Is there any way to parse cetain fields to number/array before it reaches the dto??
This happens only with postman, in Postman formmultipart everthing is sent as text. Wont happen when you use Axios in front end
I am trying to grab values from an excel spreadsheet that has been uploaded to a CRM called "Zoho" and the only way to read the file is to download the file through Zoho's own API. However, when trying to download an .xlsx file through the API, the file is encoded and I cannot figure out how to decode it and read the file. The request, when completed, returns a plaintext file with many question marks in it. What is the correct way to decode the file/is there a better way I could be doing this? Ultimately I want to read the value from the file, then make another request to another API to update a value; at no point do I need to download the excel file locally.
Here is the documentation for the Zoho API: https://www.zoho.com/docs/zoho-docs-api.html
Here is a code snippet where I make a request:
And finally this is what the result looks like:
Any help would be greatly appreciated!
I'm trying to get all documents in an envelope as a single PDF, if I call this REST API URL:
/v2/accounts/{$accountId}/envelopes/{$envelopeId}/documents/combined
It returns a bunch of data, however, I can't find a way to store this data as a valid PDF. When I output the content with headers it does download a file, but it's not a valid PDF. Also when I store the content in a file, it will not be a valid PDF file.
Anyone encountered this problem and knows how to solve this?
The content comes back as a file, you have to read the temp file and save that to the desired file
Quick snippet using file_get_contents and file_put_contents
$docStream = $envelopeApi->getDocument($accountId, 1, $envelopeId);
file_put_contents("my_document.pdf", file_get_contents($docStream->getPathname()));
More info DocuSign REST API :: EnvelopeDocuments: get under Get a Single Document as a PDF File
I have my code working to upload a PDF document, but I am trying to get it to upload an HTML document and having trouble. My code that works for the PDF document is this:
$documents = new Document();
$documents->setName($doc_name . '.pdf');
$documents->setDocumentId(1);
$documents->setFileExtension('pdf');
$file = file_get_contents($file_url);
$documents->setDocumentBase64(base64_encode($file));
But when I try to do this with an HTML document it fails. My HTML attempt uses this:
$documents = new Document();
$documents->setName($doc_name . '.pdf');
$documents->setDocumentId(1);
$documents->setFileExtension('html');
$documents->setDocumentBase64(base64_encode($html));
When I try this using the REST API Explorer I get this error message:
System was unable to convert this document to a PDF. Unable to convert Document(SampleHTML) to a PDF. Error: UserId:xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx IPAddress:54.213.184.61 Source:ApiRESTv2:FileType UNKNOWN is ineligible for conversion.
I have read that html is an accepted file type, so I am pretty sure this is possible. I could cover to PDF on my server and send, but would rather pass that off to Docusign.
Any help is greatly appreciated.
Thom
The DocuSign platform does indeed accept multiple document formats, however there may be a difference between what the DS Apps accept and what the API accepts. The list of supported document types that you can send through the DocuSign Console can be found here:
https://support.docusign.com/guides/ndse-user-guide-supported-file-formats
However I'm not sure if .html is an accepted file format when sending through the API. I thought there might be security issues with that but not positive at this point. In either case, even though you are setting the fileExtension property it looks like you are still sending a document with a filename that ends with .pdf, have you tried removing that or changing to .html?
I'm trying to post an envelope but it keeps failing for non-pdf file with the following failure:
<errorCode>UNABLE_TO_LOAD_DOCUMENT</errorCode>
<message>Unable to load the document. Unable to load Document(1;Parking Application). Error: the document is corrupt, rebuilding failed </message>
I know that I can trying sending the document as multi-part request but I'm wondering what is the issue in this request:
https://drive.google.com/file/d/0B4IcppTb9svVSFhXYkdFa0gtbms/view
it contains a word document.
It doesn't seem to be an issue with the base64 encoded string because the string can be decoded back to the file just fine e.g. using http://www.motobit.com/util/base64-decoder-encoder.asp
You forgot to include the
<fileExtension>docx</fileExtension>
node in your XML adjacent to the documentBase64 node.
(The snippet above assumes you're sending a docx file. Change it to whatever the filetype is.)
In other words, if your document is not a pdf, you need to tell the platform what the format of your documents are. It assumes pdf.