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
Guest
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: 4,088

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...
*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.4(behaviours1.5.2+fusion9.2+1.0+applicatifs2.3.0+dashboard 0.8.9)hebergé sur serveur mutualisé.
*GLPI 9.3  en test (ubuntu 16.04 mariadb 10.2.4) (attente 9.3.1 et plugin compatible avant mise en prod)

Offline

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

NicolasSousa
Guest
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
Guest
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
Guest
Registered: 2018-03-29
Posts: 7

Re: Search Parameters Via API

Nevermind, I managed to do it smile

Offline

Board footer

Powered by FluxBB