• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Sending MS Word Document in multipart/form data request

New Here ,
Nov 15, 2018 Nov 15, 2018

Copy link to clipboard

Copied

Hi,

I am working on a POC where I need to send word document to Transient Document API using REST call. Bellow is the request which I am sending.

----AdobeSignApiboundary
Content-Disposition: form-data; name="File-Name"
Sample_Letter.doc

----AdobeSignApiboundary
Content-Disposition: form-data; name="Mime-Type"
application/msword

----AdobeSignApiboundary
Content-Disposition: form-data; name="File"; filename="Sample_Letter.doc"
ContentType: application/msword
Content-Transfer-Encoding: binary
�� ࡱ �> ��   j l ����i��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������   � �  �  bjbj � �   7 }��c}��c ,�� �� �� �~ ~ � � � � �  ����� � � 8   %  � � l 9 9 9 9 9 m m m y  { { { { { { $f �   t�  � m m m m m � � � 9 9 4 �  � � � m F� 9 � 9 y � m y � � � 9 �����mc��|� ����� F� e  � 0� � � � ^� � � � � �m m � m m m m m � � W Fm m m � m m m m ��������������������������������������������������������������������� m m m m m m m m m ~

� :       

Sample Letter
 


     

l�l�l� �

      
   * , . 0 2 4 8 : > @ D F J L N Z \ ^ ` ����˼˯����������~ufYL?  h� �OJQJmH nH u    h ~ OJQJmH nH u    h�?�OJQJmH nH u    hB ?5 �OJQJmH nH u    h�?�mH nH u    j hJw� h�?�U  mH nH u    h� Y  j h� YU    h
~YOJ QJ ^J   h� �OJ QJ ^J   h�x  h�E�OJ QJ ^J   h�x  h�x CJ(OJ QJ ^J   h�x OJ QJ ^J   hmsjB* OJ QJ ^J ph  hNK�B* OJ QJ ^J ph  h�I�B* OJ QJ ^J ph         
     , 2 6 8 < > B D H J N \ �������������������
  ��  �^�� gd� �   �gdB ?   d�  �gd�?�

����   �F Microsoft Word 97-2003 Document
MSWordDoc Word.Document.8�9�q

----AdobeSignApiboundary--

but the response I am getting from Adobe is

{     "code": "NO_FILE_CONTENT",     "message": "Must provide file body" }

I am not sure where is the problem.

Views

3.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Nov 16, 2018 Nov 16, 2018

Hi pavanin617226,

I don't know if this code can help you , but i post my solution (which works with pdf) :

------WebKitFormBoundary7MA4YWxkTrZu0gW

Content-Disposition: form-data; name="File-Name"

FileName

------WebKitFormBoundary7MA4YWxkTrZu0gW

Content-Disposition: form-data; name="Mime-Type"

MimeType

------WebKitFormBoundary7MA4YWxkTrZu0gW

Content-Disposition: form-data; name="File"; File-Name="'+ FileName + '"

Content-Type:  MimeType

Content-Transfer-Encoding: base64

YourPDF

------WebKitFormBoundary7MA4YW

...

Votes

Translate

Translate
Explorer ,
Nov 15, 2018 Nov 15, 2018

Copy link to clipboard

Copied

Hi pavanin617226,

Your request seems correct, did you encode this request and set it to the body ?

Regards,

Romain.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 15, 2018 Nov 15, 2018

Copy link to clipboard

Copied

Hi romainl745608,

The input we are receiving is base64 encoded file. We are custom creating above multipart request with decoded file content and sending it as is in body.

I am able to send docx file with  Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document but getting above issue with doc files

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 15, 2018 Nov 15, 2018

Copy link to clipboard

Copied

Hi pavanin617226,

If you receive a base64 encoded file, why you don't send directly your file in base64 without decode it like that :

----AdobeSignApiboundary
Content-Disposition: form-data; name="File-Name"
Sample_Letter.doc

----AdobeSignApiboundary
Content-Disposition: form-data; name="Mime-Type"
application/msword

----AdobeSignApiboundary
Content-Disposition: form-data; name="File"; filename="Sample_Letter.doc"
ContentType: application/msword
Content-Transfer-Encoding: base64

yourfile

Regards,

Romain.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 16, 2018 Nov 16, 2018

Copy link to clipboard

Copied

Hi romainl745608,

I tried with sending base64 file contents as above mentioned but still received the same "No File Content" response.

For docx files also, I am able to send some files but receiving error for others, all are Word 2016 files.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 16, 2018 Nov 16, 2018

Copy link to clipboard

Copied

Hi pavanin617226,

I don't know if this code can help you , but i post my solution (which works with pdf) :

------WebKitFormBoundary7MA4YWxkTrZu0gW

Content-Disposition: form-data; name="File-Name"

FileName

------WebKitFormBoundary7MA4YWxkTrZu0gW

Content-Disposition: form-data; name="Mime-Type"

MimeType

------WebKitFormBoundary7MA4YWxkTrZu0gW

Content-Disposition: form-data; name="File"; File-Name="'+ FileName + '"

Content-Type:  MimeType

Content-Transfer-Encoding: base64

YourPDF

------WebKitFormBoundary7MA4YWxkTrZu0gW--

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 16, 2018 Nov 16, 2018

Copy link to clipboard

Copied

Thanks for sharing your code, will try this and let you know.

Additionally whenever there was a success while sending the document, even though the document is not 100 pages, I get an email saying Page limit has exceeded.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2018 Nov 18, 2018

Copy link to clipboard

Copied

Hi romainl745608,

I tried the above code with base64 encoding, but initially it was giving same error as "No File Content"

After a lot of debugging, we have found that instead of one we have to add two ""CRLF"  after the "Content-Transfer-Encoding" header.

We tried for both doc (application/msword) and docx files and its working fine.

Bellow is the working code:

------WebKitFormBoundary7MA4YWxkTrZu0gW + CRLF

Content-Disposition: form-data; name="File-Name" + CRLF

FileName + CRLF+ CRLF

------WebKitFormBoundary7MA4YWxkTrZu0gW + CRLF

Content-Disposition: form-data; name="Mime-Type" + CRLF

application/vnd.openxmlformats-officedocument.wordprocessingml.document + CRLF + CRLF

------WebKitFormBoundary7MA4YWxkTrZu0gW + CRLF

Content-Disposition: form-data; name="File"; File-Name="'+ FileName + '" + CRLF

Content-Type:  application/vnd.openxmlformats-officedocument.wordprocessingml.document + CRLF

Content-Transfer-Encoding: base64 + CRLF + CRLF

base64 docx content + CRLF + CRLF

------WebKitFormBoundary7MA4YWxkTrZu0gW--

Thank you for your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 15, 2021 Feb 15, 2021

Copy link to clipboard

Copied

Did you enclose your base 64 docx content in quotes?  What does your header request include other than Authorization: Bearer <key> ??

 

I have tried many variations and have not been able to make a successful /transientDocuments POST.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

LATEST

Hi,

Was anyone able to make a successful base64 POST transientdocument API call?

 

We have a similar requirement but it give errors as mentioned in this post.

 

Thanks

Swaps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines