You are not logged in.
Hello,
I'm trying to integrate our monitoring alert system with GLPI. I can easily create a new ticket using the API (either PHP or Python library). After that, I want to associate the affected computer(s) with the new ticket but I cannot find a way to add an item to a ticket using the API. Is there any documentation or examples showing how to update "Items" in Tickets using the API?
Thanks,
-Josh
Last edited by jmalone_lancium (2023-01-03 15:44:52)
Offline
Can you try adding an "items_id" property to the input body? It should be an object where the keys are item types like "Computer" and the values are arrays of IDs for that item type.
Ex:
"items_id": {
"Computer": [104, 202]
}
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
That did it! Thanks!
Python library usage:
item_id=sys.argv[1].rstrip()
t_data={
'name': "Test ticket from API script",
'content': "This is only a test.\n",
'items_id': {
'Computer': [item_id]
}
}
print("Adding ticket with item %s..." % (item_id))
print(glpi.add('Ticket', t_data))
Offline