Hello,
I managed to update the status of a ticket through the examples I've found and it works perfect.
The problem is that now I want to answer the ticket via API, so that the response is recorded and in turn the ticket is updated to closed state.
The data sent are:
$f_url_connection = "$f_url_dominio_freshdesk/helpdesk/tickets/$p_ticket_freshdesk.json";
$f_data = array(
"helpdesk_ticket" => array(
"description" => $p_email_txt,
"description_html" => $p_email_html,
"status" => 5
)
);
$f_json_body = json_encode($f_data, JSON_FORCE_OBJECT | JSON_PRETTY_PRINT);
$f_header[] = "Content-type: application/json";
$f_connection = curl_init ($f_url_connection);
curl_setopt($f_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($f_connection, CURLOPT_HTTPHEADER, $f_header);
curl_setopt($f_connection, CURLOPT_HEADER, false);
curl_setopt($f_connection, CURLOPT_USERPWD, "$f_email_freshdesk:$f_contrasena_freshdesk");
curl_setopt($f_connection, CURLOPT_POSTFIELDS, $f_json_body);
curl_setopt($f_connection, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($f_connection, CURLOPT_VERBOSE, 1);
$f_response = curl_exec ($f_connection);
curl_close ($f_connection);
The problem is that the API does not work, it returns NULL, even connects to update the ticket.