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-10-20 13:49:54

tleco
Member
Registered: 2023-10-20
Posts: 2

Search for Log or Events with /search issue

Hello,
I am trying to search for Log (or Events) with the search engine (using .../apirest.php/search/Log for example), and the API do returns some results into the data key, but those results are all empty.
For example :
GET <glpi_server>/apirest.php/search/Log :

{
    "totalcount": 122,
    "count": 20,
    "sort": [
        "1"
    ],
    "order": [
        "ASC"
    ],
    "data": [
        [],
        [],
        ...
        [],
        []
    ],
    "content-range": "0-19/122"
}

Same kind of results are returned when searching on itemType "Glpi%5CEvent".

Also, when trying the route: apirest.php/listSearchOptions/Log
I only get:

{
    "common": {
        "name": "Characteristics"
    }
}

So, does anyone know if I can search for Logs or Events, with queries and filters ?

Thank you

Offline

#2 2023-10-23 13:50:04

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

Re: Search for Log or Events with /search issue

Historical data is not searchable by the current API as that type lacks search options.
There was a pull request to make historical data searchable in GLPI previously, but wasn't added due to concerns about performance:
https://github.com/glpi-project/glpi/pull/7658

I don't think that will be added in GLPI. However, you can still get some historical data at the item level by adding a "with_logs=1" query parameter.
Example:
/apirest.php/Computer/1?with_logs=1

That shows the data directly from the database for that item, so it may not be perfectly readable in some cases.


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-10-23 14:03:44

tleco
Member
Registered: 2023-10-20
Posts: 2

Re: Search for Log or Events with /search issue

Thank you very much for your answer.
That's a pitty, as I think this PR was exactly what I needed.
In case that rings a bell for anyone, here is what I need to do :
Searching for any ticket that were previously in a certain group, but not anymore, since a precise timestamp.

If anyone has an idea of how to do that, I'm interested big_smile

Thanks

Offline

#4 2023-10-23 15:45:52

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

Re: Search for Log or Events with /search issue

GLPI 10.1 will have a new API (alongside the old rather than replacing it) which isn't reliant on the existing GLPI search/search options. It may be possible to allow more access to historical data through the new API, though I haven't started development on historical data at all in the new API yet.


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

Board footer

Powered by FluxBB