You are not logged in.
Hello,
how can I create a computer asset with the full feature of inforamtion like
"Operating System", "Components", "IP Addresses" and so on , with the API with a curl command in one curl command.
E.g I can create a computer asset with the entries, shown in the first computers tab in computers:
uuid_glpi=$(uuidgen); curl -vv -u glpi:glpi -X POST -H 'Content-Type: application/json' -H "App-Token: <ID>" -H "Session-Token: <ID>" -d '{"input": [{"name": "test01","uuid": "'$uuid_glpi'" ,"serial": "'100$RANDOM'" , "locations_id": "1", "states_id": "1", "comment": "COMMENT 123", "users_id_tech": "2", "groups_id_tech":"4", "networks_id":"1", "computertypes_id":"1", "manufacturers_id":"1", "computermodels_id":"1"}] }' 'http://<glpi server>/apirest.php/Computer/' | jq
Best regards
TobRein
Offline
The OS, components and IP addresses are all linked data rather than data that exists within the Computer itself. So, you need to create the data separately and then link them.
Related item types:
- OperatingSystem: The OS item
- Item_OperatingSystem: The link between an asset and an OS
- Device*: The "model" for the component (Example DeviceProcessor, DeviceMemory, etc)
- Item_Device*: The individual component which may or may not be linked to an asset. If not linked, the itemtype and items_id fields are null and 0 respectively.
IP addresses are more complicated and I am not confident enough in how everything with them and ports are related to give an answer currently.
Maybe there is a better way to do this though. You could use the GLPI Agent to automatically send inventory information to GLPI (supported natively starting in GLPI 10).
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