unistra / python-glpi-api

Python module for interacting with GLPI using the API.
GNU General Public License v3.0
18 stars 10 forks source link

Create two entities in a row #23

Closed skreu closed 8 months ago

skreu commented 9 months ago

Hi everyone, i'm trying to create two entities...

I've got : Root i want : Root > A > B

So after initializing my glpi_api session here's my code:

glpi.add("Entity", {'entities_id':'0', 'name':'A'}) glpi.add("Entity", {'entities_id: '1', 'name':'B'})

this code is for example. it works fine creating Entity A But then i got this error on entity B : (ERROR_GLPI_ADD) No permission [...] I'm with a RECURSIVE super-admin profile.

This post in french is the closest i'm able to identify myself. But i didn't find a change_active_entity in glpi_api python module.

https://forum.glpi-project.org/viewtopic.php?id=288539

Do you have ideas ? Thanks

skreu commented 9 months ago

Appears there is a set_active_entities in glpi_api. Found it and now it works ;) Marvellous