You are not logged in.
I'm trying to use API to add some servers (approx 700 or so) automatically with curl -X POST.
One example: Let's say i need to add Operating system kernel version. Directly from database (select * from glpi_operatingsystemkernelversions;), i can see that ID is 1 and name is "4.19.0-8-amd64". - just for testing i inserted over UI that kernel version.
So, if i understand correctly, i can only use ID value IF it already is in database?
Or is there a way to post with curl JSON payload and GLPI makes new ID or something like that
Just a none working sample what i already tried:
curl -X POST \
-H 'Content-Type: application/json' \
-H "Session-Token: sdorbe11uvuaerhme402ptodh0" \
-H "App-Token: xaUpsYh2wd7mTMlEo9KabFHybQXAKrADMXGGiYWp" \
-d '{"input": [ {"name": "testing", "operatingsystemarchitectures": "x86_64", "operatingsystemkernelversions": "4.19.0-8-amd64", "dropdown_operatingsystemeditions_id": "bullseye"}]}' \
'http://localhost/apirest.php/Computer/'
This payload just makes new "computer" named Testing without no additional data.
Offline
you should first Get Id in using search endpoint:
/search/Operatingsystemarchitecture/?is_deleted=0&criteria[0][link]=AND&criteria[0][field]=1&criteria[0][searchtype]=contains&criteria[0][value]=^x86_64$&forcedisplay[0]=2
if not exists then create it using POST METHOD
*** url***
[...]/glpi955/apirest.php/Operatingsystemarchitecture/
***********payload*********
{"input" : {"name" :"MyOSArchitectureName", "comment" : "My Comment"}}
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline