I am using RingCentral PHP SDK for sending request. I tried some methods, they were working. But when I try to send fax with $rcsdk->createMultipartBuilder()
method, I get response "Bad request" message, nothing else specified.
This code return Bad Request:
$request = $this->ringcentral->createMultipartBuilder()
->setBody(array(
'to' => array(
array('phoneNumber' => '1267***0722')),
'faxResolution' => 'High',
))
->add(fopen($file->path, 'r'))
->request("/account/~/extension/~/fax");
While this work fine and fax is sent
$request = $this->ringcentral->createMultipartBuilder()
->setBody(array(
'to' => array(
array('phoneNumber' => '1267***0722')),
'faxResolution' => 'High',
))
->add('Plain Text', 'file.txt')
->request("/account/~/extension/~/fax");
Also I tried to send cURL, it also returns Bad Request
curl --request POST --url 'https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/fax' --header 'accept: application/json' --header 'authorization: Bearer '<mycode>' --header 'content-type: multipart/form-data' --data '{"attachment":"data:text/plain;name= test.txt;base64,VGVzdCBtZXNzYWdl","to":["1201***0654"]}'