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 2017-08-10 18:11:03

tahiri
Guest
Registered: 2017-08-10
Posts: 2

How to get ID in the result of Search items rest api

Can someone share a example on to to return  id as result of Search items rest api .



http://192.168.80.231/apirest.php/search/Peripheral?
criteria[0][link]=AND&criteria[0][field]=70&criteria[0][searchtype]=contains&criteria[0][value]=abhilashs

Returns the below result

{
    "totalcount": 1,
    "count": 1,
    "sort": 1,
    "order": "ASC",
    "data": [
        {
            "1": "00:AE:FA:3D:AD:9D",
            "3": "IDC02",
            "4": "Mobile",
            "5": "R38GA0LN14F",
            "16": "IMEI  : 990007012069230\r\n",
            "23": "Samsung",
            "31": "Assigned",
            "40": null,
            "53": "USA",
            "70": "abhilashs"
        }
    ],
    "content-range": "0-0/1"
}


I also need the ID of the Peripheral devices.

Offline

#2 2018-02-05 05:20:31

ptitsans
Guest
Registered: 2018-02-05
Posts: 1

Re: How to get ID in the result of Search items rest api

Hello,

You can force it direclty in the disaply of the output with forcedisplay.

Please find below an example with Python request:

return requests.get("https://" + self.ip + Session.API_VERSION_ENDPOINT + api_endpoint + "&forcedisplay[0]=2" , verify=False, headers = self._auth_header).json()

Offline

Board footer

Powered by FluxBB