How to get all the users details with Java SDK

Product/components used and version/fix level:

Detailed explanation of the problem:

Hi, My use case is to fetch the new onboarded users. I am generating a report like in last 24 hours these users onboarded on my application. With REST Endpoint I can get the details by hitting /user/:tenantId/users?pageSize=2000&withTotalPages=true.

I am facing 2 issues-

  1. There is no creationTime of user in the response. Is there any other endpoint I can access or any other method I can use by SDK to fetch the creation time of the user so that I can filter my new users.

  2. Which Method and class to use to fetch all the users details. I tried autowiring the UserApi but I didnt see any get all users method. Is there any other api or method I can use to access this method.

    @Autowired
    UserApi userApi;

Thanks & Regards,
Samanyu

  1. the User object in C8Y does not have a creationTime. As a workaround you could instead check the lastPasswordChange timestamp. Or you could keep track of the previous registered users and identify yourself the new users.

  2. The UserApi does only implement a subset of the API focussing on the current user. So you would need to call the API yourself to retrieve all users.

So basically, there is no method for retrieving all the users? or is there any other API that I can use to fetch the all users provided by sdk?

The Cumulocity IoT API does support fetching all users:
https://cumulocity.com/api/core/10.16.0/#operation/getUserCollectionResource

But the Java SDK does not implement that functionality. You would have to do the REST call yourself. Here is some discussion about how to best do that:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.