Methods > glpi.listInventoryObjects

Version Comments
1.3.0 no changes
1.2.0 must be super admin to use this method
1.1.0 You can also use glpi.listObjects is you want to search for one itemtype only
0.4.0 Method added

This method is only accessible by authenticated and super-admin users

This method searches for inventory data. It's behavior is similar to "Inventory > Status" in GLPI.

Return list of inventory objects

input a hastable

  • help option to get usage information
  • count , start, limit (optional)
return a array of hashtable
  • name : name or part of the name
  • serial : serial number or part of it
  • otherserial : inventory number or part of it

Version 1.2.0 or higher

Each parameter can be called in 2 different way :
- by value : you already know the internal ID, then you must call the 's_id' parameter
- by name : you don't know the ID, and want to look for all assets with a specific name
For example :
- users_id=4 : look for assets whose user ID is 4
- user_name=glpi : look for assets whose user is 'glpi'

$ php testrest.php --server=localhost --url=glpi080/plugins/webservices/rest.php --method=glpi.listInventoryObjects --help
+ Calling 'glpi.listInventoryObjects' on http://localhost/glpi080/plugins/webservices/rest.php?method=glpi.listInventoryObjects&server=localhost&help=1&itemtype=Computer
+ Response: Array
(
    [name] => string,optional
    [id] => string,optional
    [states_id] => integer,optional
    [state_name] => string,optional
    [locations_id] => integer,optional
    [location_name] => string,optional
    [building] => string,optional
    [room] => string,optional
    [comment] => string,optional
    [serial] => string,optional
    [otherserial] => string,optional
    [users_id] => integer,optional
    [user_name] => string,optional
    [groups_id] => integer,optional
    [group_name] => string,optional
    [date_mod] => string,optional
    [manufacturers_id] => integer,optional
    [manufacturer_name] => string,optional
    [entities_id] => integer,optional
    [entitie_name] => string,optional
    [start] => integer,optional
    [limit] => integer,optional
)

$ php testrest.php --server=localhost --url=glpi080/plugins/webservices/rest.php --method=glpi.listInventoryObjects --itemtype[0]=Computer --session=llp428ofhpecaeefh8e5j5sar5 --name=testcomputer --itemtype[1]=Monitor
+ Calling 'glpi.listInventoryObjects' on http://localhost/glpi080/plugins/webservices/rest.php?method=glpi.listInventoryObjects&server=localhost&itemtype[0]=Computer&session=llp428ofhpecaeefh8e5j5sar5&name=testcomputer&itemtype[1]=Monitor
+ Response: Array
(
    [0] => Array
        (
            [name] => testcomputer 1
            [id] => 10102
            [entities_name] => 
            [entities_id] => 
            [serial] => 
            [otherserial] => 
            [itemtype] => Computer
            [itemtype_name] => Ordinateur
        )

)

Version 1.1.0 or lower

Call

$ php testsoap.php --method=glpi.listInventoryObjects --help
+ Calling 'glpi.listInventoryObjects' on http://localhost/0.72-bugfixes/plugins/webservices/soap.php
Array
(
    [start] => integer,optional
    [limit] => integer,optional
    [name] => string,optional
    [serial] => string,optional
    [otherserial] => string,optional
    [help] => bool,optional
)

$php testsoap.php --method=glpi.listInventoryObjects --name=XP --limit=2 --session=21a43f9e48b9beee6430168e411682dd
+ Calling 'glpi.listInventoryObjects' on http://localhost/0.72-bugfixes/plugins/webservices/soap.php
Array
(
    [0] => Array
        (
            [name] => name1-XP
            [id] => 2079
            [entities_name] => Global > Entité 1
            [entities_id] => 10
            [serial] => XXXXXXX
            [otherserial] => ORDI_0000005
            [itemtype] => 1
            [itemtype_name] => Computers
        )

    [1] => Array
        (
            [name] => name2-XP
            [id] => 1864
            [entities_name] => Global > Entité 1
            [entities_id] => 10
            [serial] => YYYYYY
            [otherserial] => ORDI_0000006
            [itemtype] => 1
            [itemtype_name] => Computers
        )

)