You are not logged in.
Quick example :
curl -g -X GET \
-H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: user_token sfs9rkd0v5a2e4botcp18fycr0vhrn3gkv9xuti3" \
-H "App-Token: q9wpgvv9jck5m5yfejbq6dde6xqn346wmvjd5j03" \
-H "Session-Token: tojiubquieu3jncvrfduhh8m75" \
"http://glpi.server.com/glpi/apirest.php/search/Computer?criteria[0][field]=1&criteria[0][searchtype]=contains&criteria[0][value]=icinga" | python -m json.tool
result is as follows, and all seems fine :
{
"content-range": "0-3/4",
"count": 4,
"data": [
{
"1": "icinga",
"17": "Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz",
"19": "2016-09-12 10:50:11",
"23": null,
"3": null,
"31": null,
"35": 8192,
"4": "Virtuozzo",
"40": null,
"45": "Debian GNU/Linux 7.11 (wheezy)",
"5": null,
"5160": null
},
{
"1": "icinga",
"17": null,
"19": "2016-09-06 10:48:21",
"23": null,
"3": "DC_C > SD_18",
"31": null,
"35": null,
"4": "Virtuozzo",
"40": null,
"45": null,
"5": null,
"5160": null
},
{
"1": "icinga",
"17": "Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz",
"19": "2017-01-09 14:04:16",
"23": null,
"3": "DC_C > SD_18",
"31": null,
"35": 8192,
"4": "Virtuozzo",
"40": null,
"45": "Debian GNU/Linux 7.11 (wheezy)",
"5": null,
"5160": "FusionInventory-Agent_v2.3.18"
},
{
"1": "icinga2",
"17": "Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz",
"19": "2016-11-07 09:49:59",
"23": null,
"3": "DC_C > SD_18",
"31": null,
"35": 8192,
"4": "Virtuozzo",
"40": null,
"45": null,
"5": null,
"5160": "FusionInventory-Agent_v2.3.18"
}
],
"order": "ASC",
"sort": 1,
"totalcount": 4
}
Now let's narrow down the search to only "icinga" hosts.
curl -g -X GET \
-H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: user_token sfs9rkd0v5a2e4botcp18fycr0vhrn3gkv9xuti3" \
-H "App-Token: q9wpgvv9jck5m5yfejbq6dde6xqn346wmvjd5j03" \
-H "Session-Token: tojiubquieu3jncvrfduhh8m75" \
"http://glpi.server.com/glpi/apirest.php/search/Computer?criteria[0][field]=1&criteria[0][searchtype]=equals&criteria[0][value]=icinga" | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 74 100 74 0 0 858 0 --:--:-- --:--:-- --:--:-- 860
{
"content-range": "0--1/0",
"count": 0,
"order": "ASC",
"sort": 1,
"totalcount": 0
}
That is a bit odd, isn't it ?
Offline