We are fetching group users using ‘/rest/api/2/group/member’ api from our addon.
But getting
org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found
when group name has ‘+’ character in it.
Sample code -
RestTemplate restTemplate = atlassianHostRestClients.authenticatedAsAddon();
String baseUrl = companyService.getBaseUrl(companyId);
if (baseUrl == null)
return null;
try {
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(baseUrl + "/rest/api/2/group/member")
.queryParam("groupname", group)
.queryParam("includeInactiveUsers", true)
.queryParam("startAt", startAt).queryParam("maxResults", maxResults);
ResponseEntity<String> response = restTemplate.getForEntity(uriBuilder.encode().build().toUri(),
String.class);
if (response.getStatusCodeValue() != Status.OK.getStatusCode())
return null;
return commonUtils.jsonStringToObject(response.getBody(), JsonObject.class);
} catch (Exception e) {
logger.error("Exception at getPaginatedGroupUsers", e);
}
Explicit encoding also doesn’t work.
Please help.