Getting a list of group members using the API | XM Community
Skip to main content

Hi everybody!
I feel like I searched the entire API documentation but haven't found what I need: A list of members for a certain group (the same thing could also apply to divisions, for example, but groups are what we currently use). Going to [Admin | Groups] in the UI yields exactly this, by the way, but I want to automate/speed up certain reporting tasks that we have to carry out regularly.
There are instructions on "Managing Groups", "Managing Users", "Get User", "Get Group", however, I see no way of combining the respective API calls into a group member list. Neither do the group-related responses yield a member list nor do the user-related responses contain group affiliations. Am I missing something here?

def listObject(object):
  URL = f"{qualtricsBaseURL}/API/v3/{object}"
  headers = {
    'Authorization': f"Bearer {bearerToken}"
  }
   
  result = r]
  while URL is not None:
    r = requests.get(URL, headers=headers)
    r.raise_for_status()
    URL = r.json()s"result"]"nextPage"]
    result += r.json()e"result"]"elements"]
     
  return result

groupId = "GR_...."
listObject("groups/" + groupId + "/members")


Maybe I missed it before, maybe it's new, but there is an API endpoint that does exactly this: List Users in Group. Nonetheless, evgaste1, thanks for your answer!


Leave a Reply