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 2018-04-03 10:44:17

NicolasSousa
Guest
Registered: 2018-03-29
Posts: 7

C# Add Assigned to

I tried to do a PutAsync through my C# program to make the ticket assigned to a specific person, i've done this:

HttpResponseMessage response = await client.PutAsync("apirest.php/Ticket/", contentString);

My contentString goes with this:
"{\"input\":{\"tickets_id\":8316,\"users_id\":10,\"type\":\"2\"}}"

When i do this Put it says OK, but doesn't appear the person to who i assigned it in the interface, what is wrong?

Last edited by NicolasSousa (2018-04-03 11:44:23)

Offline

#2 2018-04-03 12:23:20

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

Re: C# Add Assigned to

you're trying to add user to "Ticket". you should add user to "Ticket_User"

try this

$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/";


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.3(behaviours1.5.2+fusion9.2+1.0+applicatifs2.3.0+dashboard 0.8.9)hebergé sur serveur mutualisé.
*GLPI 9.3 RC2 en test (ubuntu 16.04 mariadb 10.2.4)

Offline

#3 2018-04-03 12:28:54

NicolasSousa
Guest
Registered: 2018-03-29
Posts: 7

Re: C# Add Assigned to

client.PutAsync($"apirest.php/Ticket/{ticketUpdate.tickets_id}/Ticket_User/", contentString);

I've done just like you said, it says OK but still not appearing!

Last edited by NicolasSousa (2018-04-03 12:30:21)

Offline

#4 2018-04-03 12:55:26

NicolasSousa
Guest
Registered: 2018-03-29
Posts: 7

Re: C# Add Assigned to

Found it, instead of a Put I should do a Post.
It's Working now, thank you

Offline

Board footer

Powered by FluxBB