Glpi: [REST API] can't get componants info

Created on 13 Apr 2017  路  5Comments  路  Source: glpi-project/glpi

Hi,
i try to get componants info with the new rest-api on GLPI 9.1.2 without success.
i use FusionInventory 9.1+1.0 and fusioninventory-agent 2.3.10 on debian, and it works fine with user intrface, i get all i want there.

But when i use the REST API :
http://MYSERV/apirest.php/Computer/8279?with_components=True&with_disks=True
i get the "_disks" node, but there is no "_coponants" (or somethings) in the json output.

json{ "_disks": [ { "name": { "date_creation": null, "date_mod": "2017-04-13 14:48:32", "device": "rootfs", "entities_id": 0, "filesystems_id": 24, "freesize": 5758, "fsname": "rootfs", "id": 51391, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/24", "rel": "Filesystem" } ], "mountpoint": "/", "name": "/", "totalsize": 7254 } }, { "name": { "date_creation": null, "date_mod": null, "device": "/dev/sda1", "entities_id": 0, "filesystems_id": 4, "freesize": 180, "fsname": "ext4", "id": 51394, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/boot", "name": "/boot", "totalsize": 239 } }, { "name": { "date_creation": null, "date_mod": "2017-04-13 14:33:46", "device": "/dev/mapper/vg_data-lv_home", "entities_id": 0, "filesystems_id": 4, "freesize": 880, "fsname": "ext4", "id": 51395, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/home", "name": "/home", "totalsize": 1951 } }, { "name": { "date_creation": null, "date_mod": null, "device": "/dev/mapper/vg_system-lv_tmp", "entities_id": 0, "filesystems_id": 4, "freesize": 907, "fsname": "ext4", "id": 51396, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/tmp", "name": "/tmp", "totalsize": 975 } }, { "name": { "date_creation": null, "date_mod": "2017-04-13 14:48:32", "device": "/dev/mapper/vg_data-lv_afs7", "entities_id": 0, "filesystems_id": 4, "freesize": 546033, "fsname": "ext4", "id": 51397, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/usr/local/afs7", "name": "/usr/local/afs7", "totalsize": 609099 } }, { "name": { "date_creation": null, "date_mod": "2017-04-13 14:48:32", "device": "/dev/mapper/vg_system-lv_var", "entities_id": 0, "filesystems_id": 4, "freesize": 3356, "fsname": "ext4", "id": 51398, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/var", "name": "/var", "totalsize": 4911 } }, { "name": { "date_creation": null, "date_mod": null, "device": "/dev/mapper/vg_system-lv_tmp", "entities_id": 0, "filesystems_id": 4, "freesize": 907, "fsname": "ext4", "id": 51399, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/var/tmp", "name": "/var/tmp", "totalsize": 975 } }, { "name": { "date_creation": null, "date_mod": null, "device": "/dev/mapper/vg_data-lv_www", "entities_id": 0, "filesystems_id": 4, "freesize": 376, "fsname": "ext4", "id": 61055, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/var/www", "name": "/var/www", "totalsize": 476 } }, { "name": { "date_creation": null, "date_mod": "2017-04-13 14:48:32", "device": "/dev/disk/by-uuid/53ea979f-6942-4911-b9c2-e270dbe07e3a", "entities_id": 0, "filesystems_id": 4, "freesize": 5758, "fsname": "ext4", "id": 62198, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/4", "rel": "Filesystem" } ], "mountpoint": "/", "name": "/", "totalsize": 7254 } }, { "name": { "date_creation": null, "date_mod": null, "device": "udev", "entities_id": 0, "filesystems_id": 30, "freesize": 10, "fsname": "devtmpfs", "id": 61053, "is_dynamic": 1, "links": [ { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/Filesystem/30", "rel": "Filesystem" } ], "mountpoint": "/dev", "name": "/dev", "totalsize": 10 } } ], "autoupdatesystems_id": "FusionInventory", "comment": "x86_64/00-05-24 22:15:36", "computermodels_id": "PowerEdge R415", "computertypes_id": "Rack Mount Chassis", "contact": "ymfinidori", "contact_num": null, "date_creation": null, "date_mod": "2017-04-13 14:48:32", "domains_id": "vitry.exploit.anticorp", "entities_id": "inventory-srv01", "groups_id": 0, "groups_id_tech": 0, "id": 8279, "is_deleted": 0, "is_dynamic": 1, "is_recursive": 0, "is_template": 0, "links": [ { "href": "http://MYSERV/apirest.php/OperatingSystemArchitecture/1", "rel": "OperatingSystemArchitecture" }, { "href": "http://MYSERV/apirest.php/Entity/0", "rel": "Entity" }, { "href": "http://MYSERV/apirest.php/OperatingSystem/78", "rel": "OperatingSystem" }, { "href": "http://MYSERV/apirest.php/OperatingSystemVersion/121", "rel": "OperatingSystemVersion" }, { "href": "http://MYSERV/apirest.php/AutoUpdateSystem/1", "rel": "AutoUpdateSystem" }, { "href": "http://MYSERV/apirest.php/Domain/8", "rel": "Domain" }, { "href": "http://MYSERV/apirest.php/ComputerModel/17", "rel": "ComputerModel" }, { "href": "http://MYSERV/apirest.php/ComputerType/20", "rel": "ComputerType" }, { "href": "http://MYSERV/apirest.php/Manufacturer/1", "rel": "Manufacturer" }, { "href": "http://MYSERV/apirest.php/User/16", "rel": "User" }, { "href": "http://MYSERV/apirest.php/Computer/8279/ReservationItem/", "rel": "ReservationItem" }, { "href": "http://MYSERV/apirest.php/Computer/8279/Document_Item/", "rel": "Document_Item" }, { "href": "http://MYSERV/apirest.php/Computer/8279/Contract_Item/", "rel": "Contract_Item" }, { "href": "http://MYSERV/apirest.php/Computer/8279/Infocom/", "rel": "Infocom" }, { "href": "http://MYSERV/apirest.php/Computer/8279/Item_Ticket/", "rel": "Item_Ticket" }, { "href": "http://MYSERV/apirest.php/Computer/8279/Item_Project/", "rel": "Item_Project" }, { "href": "http://MYSERV/apirest.php/Computer/8279/NetworkPort/", "rel": "NetworkPort" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceMotherboard/", "rel": "DeviceMotherboard" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceProcessor/", "rel": "DeviceProcessor" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceMemory/", "rel": "DeviceMemory" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceHardDrive/", "rel": "DeviceHardDrive" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceNetworkCard/", "rel": "DeviceNetworkCard" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceDrive/", "rel": "DeviceDrive" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceControl/", "rel": "DeviceControl" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceGraphicCard/", "rel": "DeviceGraphicCard" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceSoundCard/", "rel": "DeviceSoundCard" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DevicePci/", "rel": "DevicePci" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DeviceCase/", "rel": "DeviceCase" }, { "href": "http://MYSERV/apirest.php/Computer/8279/DevicePowerSupply/", "rel": "DevicePowerSupply" } ], "locations_id": 0, "manufacturers_id": "Dell Inc.", "name": "myserv01", "networks_id": 0, "operatingsystemarchitectures_id": "x86_64", "operatingsystems_id": "Debian", "operatingsystemservicepacks_id": 0, "operatingsystemversions_id": 7.11, "os_kernel_version": "3.16.0-0.bpo.4-amd64", "os_license_number": null, "os_licenseid": null, "otherserial": null, "serial": "J7WX95J", "states_id": 0, "template_name": null, "ticket_tco": 0, "users_id": "ymfinidori", "users_id_tech": 0, }

the web interface that show componants here : http://pasteboard.co/3OjZnfj9i.png

How can i get the CPU info (nb thread/core) ?

api bug

All 5 comments

i had same problem, after i read the code, the key is "with_devices" and not "with_components"...
A documentation mistake again...

you right, the key "with_devices" do the job.
A big TY

A documentation mistake again...

This "again" is annoying.
Next time, you can also open a PR to get things fixed. New contributors are always welcome.

Anyways, thanks for the the solution.

Sorry for "again" i was a bit angry after loose a day on it. Next time i will open PR
Otherwise, i like this usefull Rest API, thx for the good job
Have a good day !

Sorry for "again" i was a bit angry after loose a day on it. Next time i will open PR

I can understand... But I was also a bit angry to see that :D Well, it'll be fixed very soon anyways!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mab18 picture mab18  路  5Comments

Aijt picture Aijt  路  6Comments

hypemonkey picture hypemonkey  路  5Comments

iaanpermana picture iaanpermana  路  4Comments

Megachip picture Megachip  路  6Comments