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
Member
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: 6,146

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...
GLPI10.0.10 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.2 reports 1.16.0 formcreator 2.13.8, datainjection 2.13.4 fields 1.21.6

Offline

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

NicolasSousa
Member
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
Member
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