Fetch users Data from tenant using java microservice using cumulocity sdk


i want to develop a service that reads all the users data from the tenant,
ex: user email, tenatant url, lastlogin time etc.

as of now i am calling API using rest template in java, but i want to use cumulocity sdk to feth the user details, which fetch the tenant url at run time and calls user API for that particular tenant.

is it possible that i can achive this using cumulocity sdk, if yes please provide the reference doc.

if no please provide the infor why i cant call user API for above requirement using cumulocity sdk.

Hi @jkpatil1010 May be you should try using Cumulocity Java SDK UserApi to do the same thing, it’s available with Java SDK - UserApi (Cumulocity SDK - Java Client API)
You should explore option of using RestConnector - RestConnector (Cumulocity SDK - Java Client API)

1 Like

Hi @Vachaspati_Diwevedi2 ,

Actually i want fetch audit record of the all the users in the tenant.
can you suggest any way to fetch audit records of all the users in tenant using cumulocity java sdk.

i have tries using auditrecord interfaces in sdk but not getting any response.

Hi @jkpatil1010
For Audit records you should use the Audit record API available in the java SDK - AuditRecordApi (Cumulocity SDK - Java Client API)
This API provides a list of below methods, you must use the method " getAuditRecordsByFilter​(AuditRecordFilter filter) and you should add the below audit record filters to fetch all the audit records of specific user.


You could set this filter with java SDK code using the below “AuditRecordFilter” Class - AuditRecordFilter (Cumulocity SDK - Java Client API)

You could add additional filters by extending Filter class - Filter (Cumulocity SDK - Java Client API)



I want to fetch all the users list from the tenant using cumulocity sdk.
is it possible using cumulocity sdk, if yes please provide doc ref.

Note: i want to fetch list of all the users in the tenant. using cumulocity sdk

Vachaspati has already answered that question in his first reply. Please carefully consider the help you receive and try to describe what you actually need in the first message. Also the the links you received are into the reference documentation. All services the SDK supports are documented there.


Hi @Harald_Meyer ,

I dont see any method in UserApi that gives me the list of all the Users from the tenant.

I can see that There are functions in UserApi to fetch only particular user and current user.

so, is this the limitation of userApi that we can fetch only particular user and current user from the tenant and not all the users from the tenant in single response.

or is there any way that we can fetch all the users from the tenant using any other Api.

I have uploaded the screen shot of supported functions in userApi interface.
kindly verify this.

kindly reply on this.

Getting all users using the SDK is currently not supported. All other available options were already posted by Vachas.
What’s wrong with using the RestConnector as Vachas has suggested?


Please follow the community rules and don’t open 2 threads to the same topic, also please read the answers carefully.

If you think that is something that should be available in the SDK you can create a feature request here: https://cumulocityiot.ideas.aha.io/