Is there a java API that will return a list of all users in my Orgainization?

Answered

Comments

5 comments

  • Andreas Haugstrup Pedersen

    Hi Bryan,

    The API opration you are looking for is probably this one https://developers.podio.com/doc/organizations/get-organization-members-50661 

    As it's a recent method I don't think it's been added specifically to our Java client, but you can always add it yourself.

    /Andreas

    0
    Comment actions Permalink
  • Bryan Bible

    Andreas,

    Here is the code I user to add it to the API. Everything compiles and I can call the method but I am getting unexpected results. 

    public List<User> getOrganizationMembers(int orgId) {

    return getResourceFactory().getApiResource("/org/" + orgId + "/member/").get(new GenericType<List<User>>() {});

    }

    Does this API look correct? Here is a snippet of how I call the API:

     

    List<User> memberList = apiFactory.getAPI(OrgAPI.class).getOrganizationMembers(SPOrg_id);

    I then iterate over the list and call something simple like 'getMail()' or 'getCreatedOn()' but it returns either 0 or null. The iterator seems to be iterating over the correct number of entries but perhaps the entries arent correct. One thing that concerns me is that if I run the '

    Organizations: Get organization members

    from the sandbox, it returns the list of all my users but the list looks like it is a list or Profiles and not Users. Can you confirm this? If so then I would need to change the API to return Profile instead of User? Or am I way off here (most likely)

     

    Thanks,

     

    Bryan

    0
    Comment actions Permalink
  • Christian Holm

    Hi Bryan

    The list of objects returned is actually not a user, but an object with more information. I will make the API method for this call and put it on GitHub. Then you can copy from there.

    The code was otherwise correct.

    Christian

    0
    Comment actions Permalink
  • Christian Holm

    Hi again

    I have added the method and released a new version to the maven repositories. It should show up within an hour.

    Christian

    0
    Comment actions Permalink
  • Bryan Bible

    Christian,

    Thank you!! 

    Bryan

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk