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-03-29 16:02:09

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

Search Parameters Via API

Hi all,
I'm new to glpi and Web API and im trying to search for tickets with a certain parameter.
So let's say i wanted to get all the tickets with urgency = 5, How could i do that?

Using C#, I think it's something like this but i dont know how to add the parameters in the URL:

client.GetAsync("apirest.php/search/Ticket/.......");

Thank you in advance.

Offline

#2 2018-03-29 16:29:33

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,287

Re: Search Parameters Via API

criteria are passed in a array.

try this :
tickets not deleted, not solved, with urgency=5

apirest.php/search/Ticket?is_deleted=0&criteria[0][field]=12&criteria[0][searchtype]=equals&criteria[0][value]=notold&criteria[1][link]=AND&criteria[1][field]=10&criteria[1][searchtype]=equals&criteria[1][value]=5

to get fields id either you use apirest.php/listSearchOptions/Ticket

or you filter in glpi helpdesk interface an copy url (that's what I Have done)


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

#3 2018-03-29 16:36:11

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

Re: Search Parameters Via API

That's it, Thank you big_smile

Offline

#4 2018-04-02 11:30:48

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

Re: Search Parameters Via API

Hi, how do i search for tickets that are between a closingdate???
ex: between: 31/03/2018 00:00:00 and 02/04/2018 00:00:00

Last edited by NicolasSousa (2018-04-02 15:24:31)

Offline

#5 2018-04-02 15:38:25

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

Re: Search Parameters Via API

Nevermind, I managed to do it smile

Offline

Board footer

Powered by FluxBB