You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2022-08-04 21:03:56

lucaszephyr
Member
Registered: 2022-04-25
Posts: 29

approve ticket via apirest

I would like to know if it is possible to approve a ticket via apirest. If so, could you give me a hint on how to configure it?

I thank everyone.

Offline

#2 2022-08-05 09:09:24

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,287

Re: approve ticket via apirest

Use PUT method to update /Ticket/$ticket_id/ITILSolution

$payload='{"input":{"status":"3","id":$solution_id}}';


Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9

Offline

#3 2023-03-16 11:02:40

jish1702
Member
Registered: 2023-03-09
Posts: 3

Re: approve ticket via apirest

I followed above solution but no luck. Where can I find the solution ID? . Currently i taken it from table " glpi_ticketvalidations"
and this output always shows  "int(0) string(0) "" int(0) NULL"

   $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='{"input":{"status":"3","id":"19"}}';
   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);
   $obj1 = json_decode($json,true);

I appreciate your help in advance..

Offline

Board footer

Powered by FluxBB