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 2020-06-23 01:16:19

diogo86
Member
Registered: 2020-06-21
Posts: 4

Followups while searching for tickets

Hello.

Yesterday I got help on another thread and now I can search for tickets that had followups in between two dates using this endpoint:

/apirest.php/search/Ticket

With these parameters:

{
  forcedisplay: [2, 36, 93],
  criteria: [
    { field: 36, searchtype: 'morethan', value: '2020-06-01 00:00:00' },
    { link: 'AND', field: 36, searchtype: 'lessthan', value: '2020-06-30 23:59:59' },
  ],
}

And this is the returned data:

[
  {1: "Ticket title...", 2: 111111, 36: ["2020-06-01 01:01:01", "2020-06-02 02:02:02", "2020-06-03 03:03:03"], 93: [11, 22]},
  {1: "Ticket title...", 2: 222222, 36: ["2020-06-01 04:04:04", "2020-06-05 05:05:05"], 93: 11},
]

However the followup dates and users are listed separately and I can't correlate them because unique users are listed only once.

How can I get the followups with their date and corresponding user?


Thank you in advance.

Offline

#2 2020-06-23 09:14:55

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

Re: Followups while searching for tickets

I use php, and this is what i would do in this case

foreach($obj[data] as $ticket){
     $ticket_id=$ticket[2];
     $url=".../apirest.php/Ticket/"$ticket_id.."/ITILFollowup/";
/**** then display ticket id and followups or build an array or....***/
}


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 2020-06-23 13:39:32

diogo86
Member
Registered: 2020-06-21
Posts: 4

Re: Followups while searching for tickets

Thank you.

I was hoping I could get those in a single request but I'll fetch them in a loop like you're suggesting.

Offline

#4 2020-06-23 13:48:30

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

Re: Followups while searching for tickets

I don't think there was another way to do that. ( it doesn't mean there is no way to achive this in one step)


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

Board footer

Powered by FluxBB