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 2017-11-06 10:44:35

sonidp7657
Guest
Registered: 2017-11-03
Posts: 11

update followup ticket

Hello,
I want to modify a ticket with APi rest in follow ups field, but i can't.
When i execute a command, i have not error and we don't have a word and i have not a new follow.
see my command :
curl -X PUT -H 'Content-Type: application/json' -H "Session-Token: xxxxxxxxxxxxxxxxxxxxxxxxxx" -H "App-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxx" -d '{"input": {"id": 43935, "users_login":"xxxxxx", "followups": "test Donw 555ddqsdqdqs5 follow"}}' 'http://glpi-dev.test.loc/apirest.php/Ticket/'
Can you help me please ?

Thanks

Offline

#2 2017-11-06 11:59:16

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 3,822

Re: update followup ticket

Hi,
do you want to update a followup or add a followup to a ticket ?


Trouver la panne avant de réparer...
*GLPI 9.1.6+fusion9.1+1.1+behaviours1.5.0+reports+fields+appliances+pdf+badges+formcreator2.5.2 PHP7.0 Mariadb10
*GLPI 9.2.2(behaviours1.5.2+fusion9.2+1.0+applicatifs2.3.0+dashboard 0.8.9)hebergé sur serveur mutualisé.

Offline

#3 2017-11-06 12:27:11

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 3,822

Re: update followup ticket

to add a followup to an existing ticket 

$ticket_id=Myticketid;
$url="http://localhost/glpi/apirest.php/Ticket/".$ticket_id."/TicketFollowup/";
   $ch = curl_init();
   $fields='{"input":{"tickets_id": "'.$ticket_id.'","is_private": "0","requesttypes_id":"'.$requesttypes_id.'","content": "solution approuvée","_close": "1","add_close": "1"}}';

    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, $fields);
    $request_result = curl_exec($ch);
    curl_close ($ch);
    $obj = json_decode($request_result,true);
echo "<br/>";

Trouver la panne avant de réparer...
*GLPI 9.1.6+fusion9.1+1.1+behaviours1.5.0+reports+fields+appliances+pdf+badges+formcreator2.5.2 PHP7.0 Mariadb10
*GLPI 9.2.2(behaviours1.5.2+fusion9.2+1.0+applicatifs2.3.0+dashboard 0.8.9)hebergé sur serveur mutualisé.

Offline

#4 2017-11-06 12:36:54

sonidp7657
Guest
Registered: 2017-11-03
Posts: 11

Re: update followup ticket

Hello,
I want to add followups in ticket for keep history. Target is to add many followup during x time.
I have tested your solution, but, "requesttypes_id" to match with which information ?

thanks

Offline

#5 2017-11-06 16:12:30

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 3,822

Re: update followup ticket

setup>dropdowns>request sources

by default :
1: helpdesk
2 : email
3 : phone
4 : direct
5 : written
6: other

you can add  (if you want) :
7 : API or use 6 :  other or anything else (that exists in YOUR dropdown)


Trouver la panne avant de réparer...
*GLPI 9.1.6+fusion9.1+1.1+behaviours1.5.0+reports+fields+appliances+pdf+badges+formcreator2.5.2 PHP7.0 Mariadb10
*GLPI 9.2.2(behaviours1.5.2+fusion9.2+1.0+applicatifs2.3.0+dashboard 0.8.9)hebergé sur serveur mutualisé.

Offline

#6 2017-11-06 17:43:40

sonidp7657
Guest
Registered: 2017-11-03
Posts: 11

Re: update followup ticket

Sorry, but when i test this request, it's not working...
curl -X PUT -H 'Content-Type: application/json' -H "Session-Token: xxxxxxxxxxxxx" -H "App-Token: xxxxxxxxxxxxxxxxx" -d '{"input": {"tickets_id": "43936","is_private": "1","requesttypes_id":"other", "content": "test Donw 555ddqsdqdqs5 follow","_close": "0","add_close": "0"}}' 'http://gxxxxxxx/apirest.php/Ticket/43936/TicketFollowup/'

i have this result "[]" and followup has been not updated....

Offline

#7 2017-11-06 23:15:11

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 3,822

Re: update followup ticket

curl -X POST -H 'Content-Type: application/json' -H "Session-Token: xxxxxxxxxxxxx" -H "App-Token: xxxxxxxxxxxxxxxxx" -d '{"input": {"tickets_id": "43936","is_private": "1","requesttypes_id": "6", "content": "test Donw 555ddqsdqdqs5 follow"}} ' 'http://gxxxxxxx/apirest.php/Ticket/43936/TicketFollowup/'

Try POST METHOD,
requesttypes_id should be an integer and space missing between : and "6"     =>  "requesttypes_id": "6"

and followup has been not updated....

this adds a followup.

update a followup is changing somme value  example: content "this is my followup" becomes content "this is my updated followup"


Trouver la panne avant de réparer...
*GLPI 9.1.6+fusion9.1+1.1+behaviours1.5.0+reports+fields+appliances+pdf+badges+formcreator2.5.2 PHP7.0 Mariadb10
*GLPI 9.2.2(behaviours1.5.2+fusion9.2+1.0+applicatifs2.3.0+dashboard 0.8.9)hebergé sur serveur mutualisé.

Offline

#8 2017-11-07 14:08:47

sonidp7657
Guest
Registered: 2017-11-03
Posts: 11

Re: update followup ticket

Hello,

thanks for your help.
Could you tell me when i can find a complet documentation please? because apirest.php/ is not simple for me.
I want to add observer atributed user but i don't know where find this infomration.

Thanks

Offline

#9 2017-11-07 18:46:01

sonidp7657
Guest
Registered: 2017-11-03
Posts: 11

Re: update followup ticket

Re, I want to add an observer user in my ticket. It is possible to add it at the creating ? Or i must execute new request for to add many obervers ?

Thanks

Offline

#10 2017-11-07 19:05:37

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 3,822

Re: update followup ticket

to add an observer :

$url=$_SESSION['api_url'] . "/Ticket/".$ticket_id."/Ticket_User";
$fields='{"input":{"tickets_id": "'.$ticket_id.'","users_id": "7","type": "3","use_notification": "1"}}';
// type 1 requester, 2 assigned,3 Observer;

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $_SESSION['headers']);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    $request_result = curl_exec($ch);
    curl_close ($ch);


Trouver la panne avant de réparer...
*GLPI 9.1.6+fusion9.1+1.1+behaviours1.5.0+reports+fields+appliances+pdf+badges+formcreator2.5.2 PHP7.0 Mariadb10
*GLPI 9.2.2(behaviours1.5.2+fusion9.2+1.0+applicatifs2.3.0+dashboard 0.8.9)hebergé sur serveur mutualisé.

Offline

#11 2017-11-22 19:10:24

sonidp7657
Guest
Registered: 2017-11-03
Posts: 11

Re: update followup ticket

Thanks for your help. It's working perfectly.

Offline

Board footer

Powered by FluxBB