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;}
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
It looks like you're new here. Sign in or register to get started.