Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,368,846
Community Members
 
Community Events
168
Community Groups

Crowd rest add Audit log

Hello everybody i wrote a simple jersey rest client to set data to the audit log

but i get a 401 Unauthorized someone have a idea what the problem is?

public ClientResponse addToAudit() {
String test = "{" +
" \"id\": 1," +
" \"timestamp\": \"2020-02-10T13:00:00.000+0000\"," +
" \"author\": {" +
" \"id\": 1," +
" \"name\": \"admin\"," +
" \"type\": \"USER\"" +
" }," +
" \"eventType\": \"APPLICATION_CREATED\"," +
" \"entities\": [" +
" {" +
" \"id\": 12," +
" \"name\": \"Jira 7.4\"," +
" \"type\": \"APPLICATION\"," +
" \"subtype\": \"JIRA\"," +
" \"primary\": true" +
" }" +
" ]," +
" \"ipAddress\": \"127.0.0.1\"," +
" \"eventMessage\": \"Application modified\"," +
" \"entries\": [" +
" {" +
" \"propertyName\": \"name\"," +
" \"oldValue\": \"JIRA 7.2\"," +
" \"newValue\": \"Jira 7.4\"" +
" }" +
" ]" +
"}";
try {
webResource = client.resource("http://10.14.1.178:8095/crowd/rest/admin/1.0/auditlog");System.out.println(encodeToBase64());
clientResponse = webResource.header("Authorization","Basic " + encodeToBase64()).type("application/json").accept("application/json").post(ClientResponse.class,test);
return clientResponse;
} catch (Exception e) {
e.printStackTrace();
return null;
}

1 answer

1 accepted

0 votes
Answer accepted

Ok the problem was that for the usermanagement path u need the application as user and for the admin path u need a user as user

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events