Skip to main content

Freshdesk Create ticket with attachment and getting error response

  • March 28, 2017
  • 1 reply
  • 214 views

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

  ["fields":"Buzz\Message\Form\FormRequest":private]=>

  array(1) {

    ["attachments[0]"]=>

    string(49) "/tmp/ca6f07a55a42da45096fe366fa4d2f23317e753a.png"

  }

  ["boundary":"Buzz\Message\Form\FormRequest":private]=>

  NULL

  ["method":"Buzz\Message\Request":private]=>

  string(3) "PUT"

  ["resource":"Buzz\Message\Request":private]=>

  string(63) "https://practosampleimport1.freshdesk.com/api/v2/tickets/<ticket_id>"

  ["host":"Buzz\Message\Request":private]=>

  NULL

  ["protocolVersion":"Buzz\Message\Request":private]=>

  float(1.1)

  ["headers":"Buzz\Message\AbstractMessage":private]=>

  array(2) {

    [0]=>

    string(49) "Authorization: Basic <ID>"

    [1]=>

    string(33) "Content-Type: multipart/form-data"

  }

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

  ["reasonPhrase":"Buzz\Message\Response":private]=>

  NULL

  ["headers":"Buzz\Message\AbstractMessage":private]=>

  array(17) {

    [0]=>

    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"

    [3]=>

    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"

    [10]=>

    string(27) "X-RateLimit-Remaining: 4996"

    [11]=>

    string(23) "X-RateLimit-Total: 5000"

    [12]=>

    string(34) "X-RateLimit-Used-CurrentRequest: 1"

    [13]=>

    string(46) "X-Request-Id: <id

    [14]=>

    string(31) "X-XSS-Protection: 1; mode=block"

    [15]=>

    string(18) "Content-Length: 52"

    [16]=>

    string(22) "Connection: keep-alive"

  }

  ["content":"Buzz\Message\AbstractMessage":private]=>

  string(52) "{"message":"We're sorry, but something went wrong."}"

Did this topic help you find an answer to your question?
This topic has been closed for comments

1 reply

aravind.sundararajan
Skilled Expert
Forum|alt.badge.img+12

Update (Apr 10): Issue was resolved through a ticket.


Hello Apurva,


Can you please help us with the X-Request ID so that we can get this checked?


Cheers!