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

INVALID_MULTIPART - Error

New Here ,
Apr 18, 2019 Apr 18, 2019

Hi,

REST API not working for me in PHP script.

If i use "Content-Type: application/x-www-form-urlencoded", i got this error below :

{"code":"UNSUPPORTED_MEDIA_TYPE","message":"Content type was not provided or is not supported"}

If i use "Content-Type: multipart/form-data;", i got this error below :

{"code":"INVALID_MULTIPART","message":"An invalid multipart was specified"}

If I use "Content-Type: application/json", i got this :

{"code":"INVALID_JSON","message":"An invalid JSON was specified"}

I don't know what to use more. Can someone tell me if my code is good ? Many thanks !

curl_setopt_array($curl, array(

  CURLOPT_URL => "https://api.eu1.echosign.com/api/rest/v6/transientDocuments",

  CURLOPT_RETURNTRANSFER => true,

  CURLOPT_ENCODING => "",

  CURLOPT_MAXREDIRS => 10,

  CURLOPT_TIMEOUT => 0,

  CURLOPT_FOLLOWLOCATION => false,

  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

  CURLOPT_CUSTOMREQUEST => "POST",

  CURLOPT_POSTFIELDS => array('File-Name' => 'CGA.pdf','File'=> new CURLFILE('')),

  CURLOPT_HTTPHEADER => array(

    "Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",

    "Content-Type: application/json",

  ),

));

Have a nice day !

Laura

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
Community Beginner ,
Jun 05, 2019 Jun 05, 2019

````

$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
Adobe Employee ,
Jul 26, 2019 Jul 26, 2019

Hi Laura,

Did the above steps help?

Please update the thread if the issue is resolved.

I have checked the account with the email address used to sign in to the Forums.

It shows that you have an Adobe Sign Developer account.

If you need any help, please contact the Adobe Sign pre-sales team form this link Adobe Sign – Plans and pricing for enterprise and individuals | Adobe Document Cloud 

They will help you be able to provide pre-sales technical assistance.

Hope the information helps.

Regards,

Meenakshi

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 ,
Oct 06, 2020 Oct 06, 2020
LATEST

Content-Type header : "multipart/form-data"

mimeType = "application/msword";

file name : Adobe-Sign.docx 

Will resolve above issue

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