Stuck with accessing apis from my plugin

Hi, I stared to upgrade our plugin from 6.7.5 to 7.9.1 and with this upgrade some of the methods I used ,for example to get all the users are missing/modified.

I tried to use multiple solutions but I couldn’t make it work.

In 6.7.5 I could easily get them with this code.

SearchRequest sr = SearchRequest.builder().setPage(page).setPageSize(PAGE_SIZE).build();
List currentQueriedUsers = wsClient.users().search(sr).getUsersList();

WsClient comes from the request
WsClient wsClient = WsClientFactories.getLocal().newClient(request.localConnector());

But in 7.9.1 it does not work since builder is removed or moved. I couldn’t found any mentions about these changes.

Could someone tell me what is the correct way to access the sonar api’s from code right know?


This code works in 7.9:

SearchRequest sr = new SearchRequest().setP("1").setPs("100").setQ("");
SearchWsResponse resp =  WsClientFactories.getLocal().newClient(request.localConnector()).users().search(sr);
for (User user : resp.getUsersList()) {


1 Like

Thanks for Your reply, will check it tomorrow and give a feedback about it!