You are not logged in.
Pages: 1
Topic closed
Hello all,
I am struggling with ticket creating using the rest api.
I am able to create a new ticket and set my needed settings.
Additionally I want to associate a computer with this new ticket.
Even add a technician group.
But I am nuable to figure out how to do this.
Does anybody have an example json for me?
GLPI 9.4.3 - Currently in Dev environment - preparing for production
-Preparing data migration from OSTicket to GLPI for the Ticketing/Helpdesk part.
-Preparing data migration from OrangeSCRUM to GLPI for the project management part.
@Working at a company that is responsible for the IT environment of over 4500 employees that have IT assets
Offline
to add assigned users and assigned groups to tickets i make it so
add assigned user ( technician) to ticket
$ticket_id="MyTicketID";
$user_id="IdOfTheTechnician";
$input='{ "input": {"tickets_id": '.$ticket_id.' ,"users_id": '.$user_id.',"type": "2","use_notification": "1"}}';
$url=$api_url . "/Ticket/".$ticket_id."/Ticket_User/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS,$input);
$json = curl_exec($ch);
curl_close ($ch);
for debug you can add :
$obj = json_decode($json,true);
echo "<br/>".$input."<br/>";
print_r($json);
Add groups to ticket
$group_id="MyGroupIDto Assign";
$input='{ "input": {"tickets_id": '.$ticket_id.' ,"groups_id": '.$group_id.',"type": "2","use_notification": "1"}}';
$url=$api_url . "/Ticket/".$ticket_id."/group_ticket/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS,$input);
$json = curl_exec($ch);
curl_close ($ch);
$obj = json_decode($json,true);
echo "<br/>".$input."<br/>";
print_r($json);
note : in $input='{ "input": {"tickets_id": '.$ticket_id.' ,"groups_id": '.$group_id.',"type": "2","use_notification": "1"}}';
you can change type to
1) requester
2)assigned
3)observer
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
to associate computer to ticket
$ticketid=MyTicketID;
$computerid='MyComputerID';
$url="/Ticket/".$ticketid."/Item_ticket/";
$fields = '{"input": { "items_id":'.$computerid.',"itemtype":"Computer","tickets_id":'.$ticketid.'}}' ;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
$json = curl_exec($ch);
curl_close ($ch);
//only for debug add:;
$obj = json_decode($json,true);
echo "<br/>".$fields."<br/>";
print_r($json);
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
LaDenrée: Thank you! These replies were very helpfull!
GLPI 9.4.3 - Currently in Dev environment - preparing for production
-Preparing data migration from OSTicket to GLPI for the Ticketing/Helpdesk part.
-Preparing data migration from OrangeSCRUM to GLPI for the project management part.
@Working at a company that is responsible for the IT environment of over 4500 employees that have IT assets
Offline
Pages: 1
Topic closed