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 2021-08-29 03:24:25

aziz
Member
Registered: 2021-03-30
Posts: 109

software assigned to a computer

Hello everybody,

How can I get software assigned to a specific computer (computer ID) using API request .
TY.

Offline

#2 2021-08-30 08:50:30

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

Re: software assigned to a computer

myserver/glpi/apirest.php/search/Software/?is_deleted=0&as_map=0
&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^Computer_ID

replace Computer_ID with tour ID ( keep ^ and $ )
it should work.


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 2021-08-30 16:08:14

aziz
Member
Registered: 2021-03-30
Posts: 109

Re: software assigned to a computer

I tested this GET request with computer id (2 for exemple) : myserver/glpi/apirest.php/search/Software/?is_deleted=0&as_map=0
&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^2$

I tried other computer IDs, but I got this response on all requests

{
  "totalcount": 0,
  "count": 0,
  "sort": "1",
  "order": "ASC",
  "content-range": "0--1/0"
}

Offline

#4 2021-08-30 16:40:43

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

Re: software assigned to a computer

it works on my 9.5.5 instance.

did you get your glpi session token ?

Is  logged API user allowed to see these softwares ? ( entity and profile).


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

#5 2021-08-30 17:25:27

aziz
Member
Registered: 2021-03-30
Posts: 109

Re: software assigned to a computer

Yea I used session token of a super admin profile 

and this the URL request :

xx.withx.glpi-network.cloud/apirest.php/search/Software/?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^2$

Offline

#6 2021-08-30 21:33:37

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

Re: software assigned to a computer

did you test this url using Glpi GUI ? 

replace xx.withx.glpi-network.cloud/apirest.php/search/Software/?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^2$

with

xx.withx.glpi-network.cloud/front/Software/?is_deleted=0&as_map=0&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^2$


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

#7 2021-09-07 22:46:05

aziz
Member
Registered: 2021-03-30
Posts: 109

Re: software assigned to a computer

Doesn't work too hmm/

Offline

#8 2021-11-29 16:53:21

anne
Member
Registered: 2021-11-29
Posts: 1

Re: software assigned to a computer

Hi,

I had the same problem

{
  "totalcount": 0,
  "count": 0,
  "sort": "1",
  "order": "ASC",
  "content-range": "0--1/0"
}
and i changed the computer ID for the test ans it worked fine.

But now i've got another problem.

myserver/glpi/apirest.php/search/Software/?is_deleted=0&as_map=0
&criteria[0][link]=AND&criteria[0][itemtype]=Computer&criteria[0][meta]=1&criteria[0][field]=2&criteria[0][searchtype]=contains&criteria[0][value]=^Computer_ID$ 

gives me the software but also give me every version of this software and not only the installed version.
Here is an example:

[3]=>
    object(stdClass)#5 (7) {
      ["1"]=>
      string(27) "Adobe Acrobat Reader DC MUI"
      ["23"]=>
      string(26) "Adobe Systems Incorporated"
      ["5"]=>
      array(5) {
        [0]=>
        string(12) "21.005.20058"
        [1]=>
        string(12) "21.005.20060"
        [2]=>
        string(12) "21.005.20048"
        [3]=>
        string(12) "21.001.20155"
        [4]=>
        string(12) "21.007.20091"
      }
      ["4"]=>
      string(7) "Windows"
      ["72"]=>
      int(143)
      ["163"]=>
      NULL
      ["2"]=>
      string(2) "51"

How can I get the installed version?

Thanks

Offline

#9 2021-12-10 16:22:32

judzk
Member
Registered: 2021-12-10
Posts: 6

Re: software assigned to a computer

anne wrote:

Hi,

I had the same problem

How can I get the installed version?

Thanks

Hi, i have the same problem here, did you find a solution ?

Offline

Board footer

Powered by FluxBB