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

API invalid multipart

New Here ,
Apr 16, 2018 Apr 16, 2018

Using both PHP Curl and Postman, i am attempting to use API v5 to create a transient document that can then be used for an agreement.  However, no matter what settings i use in the HTTP header for "Content-Type" and "Content-Disposition", beginning with the example "multipart/form-data" and "form-data; name='File"; filename:"C:\DRAFT.pdf, I only get this for the response:

code: INVALID_MULTIPART

message: An invalid multipart was specified.

2.6K
Translate
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 ,
Jul 17, 2018 Jul 17, 2018

In postman, you have to choose file type for the file you upload

Translate
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 ,
Mar 14, 2019 Mar 14, 2019

How do you choose the file type? I'm not sure what you mean by this.

Translate
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
Adobe Employee ,
Apr 11, 2019 Apr 11, 2019

See Postman screenshots

postmanv5 transientdoc.png      

postmanv5 transientdoc 2.png

When you move the mouse over the Key field in the second screenshot you get a dropdown at the end of this field to specify if it's a file or text you want to add.

For Api v6 it's mostly the same just change the access-token header to 'Authorization' and prefix your access token with the word 'Bearer ' .

Translate
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 ,
Jun 05, 2019 Jun 05, 2019
LATEST

````

$handle = curl_init();

$file = __DIR__ . DIRECTORY_SEPARATOR . "helloWorld.docx";

$header = array();

$header[] = 'Content-Type: multipart/form-data';

$header[] = 'Authorization: Bearer ' . $this->refreshToken;

$header[] = 'Content-Disposition: form-data; name=";File"; filename="helloworld.DOCX"';

// Send the raw file in the body with no other data

$fp = fopen($file, 'r');

$contents = fread($fp, filesize($file));

$postData = array(

   "File" => $contents,

   "File-Name" => 'helloWorld.docx',

     "Mime-Type" => 'application/msword'

);

curl_setopt_array($handle,

  array(

   CURLOPT_URL => $this->uploadDocumentUrl,

   CURLOPT_POST => true,

   CURLOPT_POSTFIELDS => $postData,

   CURLOPT_RETURNTRANSFER => true,

   CURLOPT_HTTPHEADER => $header

   )

);

$data = curl_exec($handle);

curl_close($handle);

fclose($fp);

````

it should work.

Translate
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