From June 7 through June 18, we will be performing minor community maintenance. As a result, email notifications may not send during this time. We apologize for any inconveniences!
You may have noticed the url for our site changed, as we are preparing to launch our community redesign. Stay on the lookout for details coming soon, and be sure to update your bookmarks!

Getting a list of group members using the API

cpschroedercpschroeder Community Member, Qualtrics Brand Admin Qubie ✭

Getting a list of group members using the API

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?

Tagged:

Answers

  • evgaste1evgaste1 Amsterdam, NetherlandsCommunity Member, Qualtrics Brand Admin Qubie ✭

    def listObject(object):

      URL = f"{qualtricsBaseURL}/API/v3/{object}"

      headers = {

        'Authorization': f"Bearer {bearerToken}"

      }

       

      result = []

      while URL is not None:

        r = requests.get(URL, headers=headers)

        r.raise_for_status()

        URL = r.json()["result"]["nextPage"]

        result += r.json()["result"]["elements"]

         

      return result


    groupId = "GR_...."

    listObject("groups/" + groupId + "/members")

Sign In to Comment