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 2018-07-23 17:54:21

david999
Member
Registered: 2018-07-23
Posts: 1

Retrieve IP address

Hello,

I am trying to perform a search of computer's IP using the computer's name.
But, even if I found some search ids using the GLPI API documentation, I am not able to retrieve this data. It seems that these ids are only available for performing a search, as filters.
What I found using the List Search Option (apirest.php/listSearchOptions/:itemtype):

"126": {
    "name": "IP",
    "table": "glpi_ipaddresses",
    "field": "name",
    "datatype": "",
    "nosearch": false,
    "nodisplay": false,
    "available_searchtypes": [
      "contains",
      "equals",
      "notequals"
    ],
    "uid": "Computer.IPAddress.name"


Is there a way to retrieve this data maybe using the uid? Or parsing the json file?


Thank you for your help.


David

Offline

#2 2018-07-24 11:33:55

AdelAchour
Member
Registered: 2018-07-23
Posts: 25

Re: Retrieve IP address

Hey David,

What you basically wanna do is retrieve the computer's ID right?

Try to add this to your header: forcedisplay[0] with the value 126 (the data ID)

http://XXX/glpi/apirest.php/search/Computer?criteria[0][field]=1&criteria[0][searchtype]=equals&criteria[0][value]=COMPUTERNAME&forcedisplay[0]=126

Offline

Board footer

Powered by FluxBB