You are not logged in.
Pages: 1
Hi Guys,
We need to make ticket validation through REST API and I am checked with /ITILSolution/ and /Ticketvalidation/ options .
I have no idea which one we use and there is no tutorials found for this .
$ch = curl_init();
$url=$api_url . "/Ticket/".$ticket_id."/Ticketvalidation/";
$input='{"input" :{"status":3,"users_id_validate":'.$users_id_approval.',"comment_validation":'.$comment_validation.'} }';
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
$request_result = curl_exec($ch);
curl_close ($ch);
can someone help me?
Thanks!
Offline
Have you tried doing a GET request on that URL first to find the ID of the desired/latest validation in the ticket, and then include the ID property in the POST fields?
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Online
Thanks for your prompt response.
This is my code. It always return NULL when i use PUT method . I can post new items and query items but not PUT.
$ch = curl_init();
$url =$api_url . "/Ticket/".$ticket_id."/ITILSolution/";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$input='{"id":17,"input": {"users_id_validate":2,"status":3}}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
$errno = curl_errno($ch);
$errmsg = curl_error($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$json = curl_exec($ch);
curl_close ($ch);
$obj = json_decode($json,true);
Last edited by jish1702 (2023-03-15 07:54:43)
Offline
Pages: 1