You are not logged in.
Hello,
I have a CSV with about 100 computer's names.
I need to create a Static computer groups to do a deploy.
The problem is that I can import only a CSV with computers' IDs, is there a way to get ID by computernames without doing it one by one?
Offline
You would need to use the GLPI API for that.
You could make a script to loop through each name, search for computers with that name through the API, and get the ID from the result.
You can enable the API and see the documentation for in in Setup > General in the API tab.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
I have tried but the search replies without indication of the id (in this case I know that the id I have to discover is 6043).
I used:
http://glpi/apirest.php/search/Computer/?&criteria[0][link]=AND&criteria[0][field]=1&criteria[0][searchtype]=contains&criteria[0][value]=PCNAME&itemtype=Computer&start=0&session_token=mysessiontoken
Reply with:
{
"totalcount": 1,
"count": 1,
"sort": [
"1"
],
"order": [
"ASC"
],
"data": [
{
"1": "NB-USERNAME",
"126": [
"10.22.11.64",
],
"7": "username@NB-USERNAME",
"70": null,
"46": "2009",
"61": "64-bit",
"40": "20RW",
"5": "LR84V81E",
"31": null
}
],
"content-range": "0-0/1"
}
Maybe I'm searching in the wrong way?
Last edited by ComLu (2023-06-14 09:48:33)
Offline
Solved:
http://glpi/apirest.php/Computer/?expand_dropdowns=true&session_token=mysessiontoken&searchText[name]=PCNAME
Last edited by ComLu (2023-06-14 09:48:09)
Offline