Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Search

    API, get person with person groups

    General
    api
    3
    3
    186
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Eduardo Casarero
      Eduardo Casarero last edited by

      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?

      F 1 Reply Last reply Reply Quote 0
      • F
        fa__ @Eduardo Casarero last edited by

        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
        }
        
        1 Reply Last reply Reply Quote 0
        • Michael Overkamp
          Michael Overkamp last edited by

          Hey @Eduardo-Casarero

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post