You are not logged in.
Pages: 1
Hi guys,
I have a problem with structure of object when i want to change it.
$obj = [
"input" => [
"_date" => "04-10-2018 09:44",
"date" => "2018-10-04 09:44:13",
"users_id_recipient" => "487",
// "_time_to_own" => " ",
// "time_to_own" => " ",
// "_time_to_resolve" => " ",
// "time_to_resolve" => " ",
// "_internal_time_to_own" => " ",
// "internal_time_to_own" => " ",
// "_internal_time_to_resolve" => " ",
// "internal_time_to_resolve" => " ",
"type" => "1",
"itilcategories_id" => "0",
"status" => "1",
"requesttypes_id" => "1",
"urgency" => "3",
"global_validation" => "1",
"impact" => "3",
"locations_id" => "5",
"priority" => "3",
"my_items" => "",
"itemtype" => "0",
"items_id" => "0",
"_itil_requester" => ["_type" => " 0"],
"_itil_observer" => [
"_type" => "user",
"users_id" => "487",
"use_notification" => [1],
"alternative_email" => ["some_mail@gmai.com]
],
"_itil_assign" => ["_type" => " 0"],
"name" => "NEW TICKET",
"content" => "<p>NEW TICKET BY REST</p>",
"_link" =>
["link" => " 1",
"tickets_id_1" => "110",
"tickets_id_2" => "0"
],
"filename" => [" (binary)"],
"update" => "Save",
"_read_date_mod" => "2018-10-18 14:43:40",
"id" => "112"
],
"format" => 'json'
];
When i'm trying to update the ticket and assign watchers (_itil_observer) or assigned users (_itil_assign) the request din't change anything. It's work correct in interface but i cant implement it in request.
Can you tell me where is my mistake? Thanks!
Offline
I'ts not possible to set observers and assigned users from api at the moment .
In the api.class.php
//update item
$object = Toolbox::sanitize((array)$object);
returns only one level key=>value object. When you set in dept like
"_itil_observer" => [
"_type" => "user",
"users_id" => "487",
"use_notification" => [1],
"alternative_email" => ["some_mail@gmai.com]
]
the function returns empty string...
Last edited by aerozol (2018-10-22 14:04:48)
Offline
if you want to add users to a ticket :
$url=$api_url . "/Ticket/".$ticket_id."/Ticket_User/";
method POST
$input='{ "input": {"tickets_id": '.$ticket_id.' ,"users_id": '.$user_id.',"type": "2","use_notification": "1"}}';
with type :
// Requester 1;
// Assign 2;
// Observer 3;
Trouver la panne avant de réparer...
*GLPI 9.4.6+fusion9.4+2.4+behaviours2.3.2+reports+fields+appliances+pdf+badges+formcreator2.10.4 PHP7.4 Mariadb10.3
*GLPI 9.4.6(behaviours2.2.1+fusioninventoty 9.4+1.1+applicatifs2.5.0+fields 1.9.1) php7.3 mysql5.6 hebergé sur serveur mutualisé.
TEST GLPI9.5.3 mutualisé OVH ( collecteur KO en pop3)
Offline
Thanks solved
Offline
Hi,
I try to change my GLPI ticket status to closed but i have a servor error, Can anyone help me to solve it
the call URL was : apirest.php/Tikcet/$tickets_id
body :{"input":{"tickets_id":"1906180012","status":"6"}}
the response was :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>500 - Internal server error.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
</fieldset></div>
</div>
</body>
</html>
Offline
Mistype in url tikcet should be Ticket
Trouver la panne avant de réparer...
*GLPI 9.4.6+fusion9.4+2.4+behaviours2.3.2+reports+fields+appliances+pdf+badges+formcreator2.10.4 PHP7.4 Mariadb10.3
*GLPI 9.4.6(behaviours2.2.1+fusioninventoty 9.4+1.1+applicatifs2.5.0+fields 1.9.1) php7.3 mysql5.6 hebergé sur serveur mutualisé.
TEST GLPI9.5.3 mutualisé OVH ( collecteur KO en pop3)
Offline
Pages: 1