API, get person with person groups
-
Hi all, am trying to find the right category to query the API and get the person object with its assigned groups, but I am not getting them. I've tried many categories, but I can't find the right one, so far this is my base query:
{ "version": "2.0", "method": "cmdb.objects.read", "params": { "categories": [ "C__CATS__ORGANIZATION_PERSONS","C__CATG__ASSIGNED_SUBSCRIPTIONS", "C__CATS__PERSON_ASSIGNED_GROUPS" ], "filter": { "type": "C__OBJTYPE__PERSON", "title": "John Doe" }, "order_by": "", "sort": "", "apikey": "xxxxxxx" }, "id": 1 }
Any hints on where is my error?
-
Hello @Eduardo-Casarero,
You should try using the method cmdb.category.read for category "C__CATS__PERSON_ASSIGNED_GROUPS" using the user id.
{ "version": "2.0", "method": "cmdb.category.read", "params": { "objID": 158, "category": "C__CATS__PERSON_ASSIGNED_GROUPS", "apikey": "XXX" }, "id": 1 }
-
youre JSon is correct but if you get categories =[] then it seems like a bug.
There is actually a open bug with these categories:"C__CATS__PERSON_GROUP_MASTER", "C__CATS__PERSON_CONTACT_ASSIGNMENT", "C__CATS__PERSON_GROUP_MEMBERS", "C__CATS__ORGANIZATION_PERSONS", "C__CATS__PERSON_ASSIGNED_GROUPS"
So you need to use the category.read method like @fa__ described.