It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Trello

The control freak's guide: using Trello to plan a relocation

My partner and I were planning this relocation for years. It was our shared dream to try and live in another country. As children of immigrants, we already have experienced this once, but this still ...

370 views 8 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you