Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Crowd rest add Audit log

Heiko
Contributor
February 10, 2020

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
Heiko
Contributor
February 14, 2020

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
AUG Leaders

Atlassian Community Events