Skip to main content

Add a note to ticket

  • August 12, 2017
  • 1 reply
  • 69 views

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

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

1 reply

  • Contributor
  • 17 replies
  • August 15, 2017

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