Highlighted

Sending MS Word Document in multipart/form data request

New Here ,
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.

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--

Topics

Questions Need Help

Views

608

Likes

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

Sending MS Word Document in multipart/form data request

New Here ,
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.

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--

Topics

Questions Need Help

Views

609

Likes

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
Explorer ,
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.

Likes

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
Reply
Loading...
New Here ,
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

Likes

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
Reply
Loading...
Explorer ,
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.

Likes

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
Reply
Loading...
New Here ,
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.

Likes

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
Reply
Loading...
Explorer ,
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--

Likes

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
Reply
Loading...
New Here ,
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.

Likes

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
Reply
Loading...
New Here ,
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.

Likes

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
Reply
Loading...