I am trying to hit freshdesk ticket generating api with attachments.
Request object :
$headers = array('Authorization' => 'Basic.ID),
'Content-Type'=>'multipart/form-data');
$url = "https://domain.freshdesk.com/api/v2/tickets/<ID>";
$request = new FormRequest();
$request->setField('attachments', array($path));
$request->setHeaders($headers);
$request->setMethod("PUT");
$request->setResource($url);
$buzzBrowser = new \Buzz\Browser();
$buzzBrowser->setClient(new \Buzz\Client\Curl());
$response = $buzzBrowser->send($request, null);
My request is:
object(Buzz\Message\Form\FormRequest)#358 (8) {
e"fields":"Buzz\Message\Form\FormRequest":private]=>
array(1) {
;"attachmentsr0]"]=>
string(49) "/tmp/ca6f07a55a42da45096fe366fa4d2f23317e753a.png"
}
2"boundary":"Buzz\Message\Form\FormRequest":private]=>
NULL
t"method":"Buzz\Message\Request":private]=>
string(3) "PUT"
e"resource":"Buzz\Message\Request":private]=>
string(63) "https://practosampleimport1.freshdesk.com/api/v2/tickets/<ticket_id>"
h"host":"Buzz\Message\Request":private]=>
NULL
R"protocolVersion":"Buzz\Message\Request":private]=>
float(1.1)
e"headers":"Buzz\Message\AbstractMessage":private]=>
array(2) {
a0]=>
string(49) "Authorization: Basic <ID>"
>1]=>
string(33) "Content-Type: multipart/form-data"
}
3"content":"Buzz\Message\AbstractMessage":private]=>
NULL
}
string(42)
The response which I am getting is :
object(Buzz\Message\Response)#365 (5) {
>"protocolVersion":"Buzz\Message\Response":private]=>
NULL
""statusCode":"Buzz\Message\Response":private]=>
NULL
d"reasonPhrase":"Buzz\Message\Response":private]=>
NULL
r"headers":"Buzz\Message\AbstractMessage":private]=>
array(17) {
s0]=>
string(34) "HTTP/1.1 500 Internal Server Error"
;1]=>
string(61) "Cache-Control: no-cache, no-store, max-age=0, must-revalidate"
2]=>
string(45) "Content-Type: application/json; charset=utf-8"
p3]=>
string(35) "Date: Tue, 28 Mar 2017 07:45:56 GMT"
4]=>
string(38) "Expires: Wed, 13 Oct 2010 00:00:00 UTC"
5]=>
string(16) "Pragma: no-cache"
6]=>
string(35) "Set-Cookie: _x_w=19; path=/; secure"
<7]=>
string(33) "Status: 500 Internal Server Error"
<8]=>
string(48) "X-Freshdesk-API-Version: latest=v2; requested=v2"
>9]=>
string(30) "X-Rack-Cache: invalidate, pass"
t10]=>
string(27) "X-RateLimit-Remaining: 4996"
l11]=>
string(23) "X-RateLimit-Total: 5000"
i12]=>
string(34) "X-RateLimit-Used-CurrentRequest: 1"
t13]=>
string(46) "X-Request-Id: <id
R14]=>
string(31) "X-XSS-Protection: 1; mode=block"
415]=>
string(18) "Content-Length: 52"
r16]=>
string(22) "Connection: keep-alive"
}
"content":"Buzz\Message\AbstractMessage":private]=>
string(52) "{"message":"We're sorry, but something went wrong."}"