Add a note to ticket

Hello,


I'm trying to add a note to ticket using api with curl but unable to add can you please help where I'm making mistake here is my code -


        $api_key = "api key";

        $password = "password";

        $yourdomain = "mindlerhelp";

        // Return the tickets that are new or opend & assigned to you

        // If you want to fetch all tickets remove the filter query param

        $url = "https://$yourdomain.freshdesk.com/api/v2/tickets/$ticket_id/conversations";

        $ticket_data = json_encode(array(

          "body" => "$body"

          //, "cc_emails" => array("vishal@mindler.com")

        ));

 

        $ch = curl_init($url);

        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

 

        $header[] = "Content-type: application/json";

        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

        curl_setopt($ch, CURLOPT_HEADER, true);

        curl_setopt($ch, CURLOPT_USERPWD, "$api_key:$password");

        curl_setopt($ch, CURLOPT_POSTFIELDS, $ticket_data);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $server_output = curl_exec($ch);

        $info = curl_getinfo($ch);

        $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

        $headers = substr($server_output, 0, $header_size);

        $response = substr($server_output, $header_size);

         curl_close($ch);

1 Comment

It looks like you're doing a GET. New notes in a conversation are done with a POST. https://developer.freshdesk.com/api/#add_note_to_a_ticket


Login or Signup to post a comment