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

    API, get person with person groups

    Scheduled Pinned Locked Moved General
    api
    3 Posts 3 Posters 467 Views 1 Watching
    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 CasareroE Offline
      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 Offline
        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 HuhnM Offline
          Michael Huhn
          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