2 Replies Latest reply on Aug 31, 2016 5:23 AM by Patrick Abernathy

    (Java) Listing members of a group

    Chris Pare

      Looking for some help accessing the members of a group.

      I have expanded on the example code to query for a complete list of groups for a site, however now I need to go back to the server with a specific groupID I want to query for it's members.

       

      Here is the code, I simply don't know if I should be using "UserType" (I really don't know what this is, what my options are, or where they are defined - my lack of Java knowledge for sure), or what I should be using where the ???? appear as eclipse didn't auto-suggest anything that looked "User" specific (when querying for groups there was an obvious getgroups().

       

          public UserType invokeQueryGroupMembers(TableauCredentialsType credential, String siteId, String groupId){
         
          m_logger.info(String.format("Entering invokeQueryGroupMembers"));
          String url = Operation.QUERY_GROUP_MEMBERS.getUrl(siteId, groupId);
         
          // Makes a GET request with the authenticity token
              TsResponse response = get(url, credential.getToken());
         
              // Verifies that the response has users
              if (response.???? != null) {
                  m_logger.info("Query groups is successful!");
      
      
                  return response.????();
              }
      
      
              // No users were found
              return null;
              
              
          m_logger.info(String.format("Exiting invokeQueryGroupMembers"));
        return null;
      
      
          }
      
        • 2. Re: (Java) Listing members of a group
          Patrick Abernathy

          Hey Chris.  I'm not a Java developer either, but I did some digging on this so I'm going for educated guess.  I grabbed a copy of the sample project and it looks like your ???? should be replaced with a property from the TsResponse.java object.  I'm basing this off of the sample for querying Projects.  In TsResponse there is a property for getProjects that returns a model of ProjectListType.  So for your query, you'll need to create a new model, GroupUserListType for example, and then add a property in TsResponse.  Be a safe bet that you will also need a Set function as well in TsResponse.  Hope this helps.