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 2023-08-28 17:13:43

entwan
Member
Registered: 2023-08-18
Posts: 5

Search on ticket with notequals

Hi, i'm trying to use the api tu search a ticket that's not closed.

So i'm trying that

myurl?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][field]=5&criteria[0][searchtype]=equals&criteria[0][value]=2&criteria[1][link]=AND&criteria[1][field]=12&criteria[1][searchtype]=notequals&criteria[1][value]=6

with the main part

criteria[1][link]=AND&criteria[1][field]=12&criteria[1][searchtype]=notequals&criteria[1][value]=6

I have as searchtype notequals but i only have in result tickets with status = 6.
like :

 "data": [
        {
            "2": 58,
            "1": "cn,",
            "12": 6,
            "19": "2023-08-25 10:00:32",
            "15": "2023-08-23 11:08:45",
            "3": 3,
            "4": null,
            "5": "2",
            "7": null,
            "18": null
        },
        {
            "2": 62,
            "1": "test",
            "12": 6,
            "19": "2023-08-25 09:31:11",
            "15": "2023-08-23 11:13:19",
            "3": 3,
            "4": null,
            "5": "2",
            "7": null,
            "18": null
        },

I don't know what i'm doing wrong ?

Thanks smile.

Last edited by entwan (2023-08-28 17:26:08)

Offline

#2 2023-08-28 22:18:00

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: Search on ticket with notequals

Which version of GLPI are you trying this with?


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2023-08-29 00:46:46

entwan
Member
Registered: 2023-08-18
Posts: 5

Re: Search on ticket with notequals

I have just created my web instance then maybe the last one ? 10.0.9 i'm not sure i don't know where to check that sorry

Offline

#4 2023-08-29 02:32:05

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: Search on ticket with notequals

The status field for Tickets, Changes and Problems is actually a unique case handled with workarounds directly in the search engine. The "notequals" search type isn't supported for it. Instead, there are special values of:
1. notold: Not Solved
2. notclosed: Not closed
3. old: Solved and Closed
4. all: Any status

In your case, you should set the searchtype to "equals" and the value to "notclosed".

The other option would be to change the link from "AND" to "AND NOT" with searchtype=equals and value=6, but using "NOT" in the link type is not always the same behavior as switching between two searchtypes like equals and notequals.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#5 2023-08-29 09:45:39

entwan
Member
Registered: 2023-08-18
Posts: 5

Re: Search on ticket with notequals

Ooh ok that's working thanks you ! smile

Offline

Board footer

Powered by FluxBB