Hello,
My version of pentaho is 5.3.
I'm trying to use pentaho API to create a user.
For now I can use the API of pentaho with the GET, but I can not manage to do a PUT.
I try to do this in JAVA using HttpsUrlConnexion and here is how I proceed.
PUT this is NOK
url = new URL("https://xxxxx/pentaho/api/userroledao/createUser");
// identification avec le ticket
hsu2 = (HttpsURLConnection) url.openConnection(proxy);
hsu2.setDoOutput(true);
hsu2.setRequestMethod("PUT");
// System.out.println(hsu2.getHeaderField("Set-Cookie"));
hsu2.setRequestProperty("Cookie", cookies);
hsu2.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
hsu2.addRequestProperty("User-Agent", "Mozilla");
hsu2.setRequestProperty("Connection", "keep-alive");
hsu2.setRequestProperty("Content-Type","application/json");
String json_create_user = "{\"userName\":\"user_name\",\"password\": \"password\"}";
OutputStream os3 = hsu2.getOutputStream();
os3.write(json_create_user.getBytes());
os3.flush();
os3.close();
hsu2.disconnect();
This return a error 500
When i do a GET and this is OK
url = new URL("https://xxxxx/pentaho/api/userroledao/users");
// identification avec le ticket
hsu2 = (HttpsURLConnection) url.openConnection(proxy);
hsu2.setDoOutput(true);
hsu2.setRequestMethod("PUT");
// System.out.println(hsu2.getHeaderField("Set-Cookie"));
hsu2.setRequestProperty("Cookie", cookies);
hsu2.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
hsu2.addRequestProperty("User-Agent", "Mozilla");
hsu2.setRequestProperty("Connection", "keep-alive");
hsu2.setRequestProperty("Content-Type","application/json");
hsu2.disconnect();
This return users of pentaho in xml format.
I used the API documentation but still the PUT does not work..
Thank's
Guillaume D