Hi All,
I'm trying to execute any call to confluence Rest Api from a java class. In the specific to create a space and then to create a page inside it.
the code to create a space is :
String spaceBody = "{ \"key\":\"RAID\", \"name\":\"Raider\",\n" +
"\"type\":\"global\", \"description\":{\"plain\": { \"value\": \"Raider Space for raiders\",\"representation\":\n" +
"\"plain\" }}}'";
String confluencePage = "https://<my-host>/wiki/confluence/rest/api/space/";
.......
URL url = new URL(confluencePage );
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Cookie", cookie);
DataOutputStream bodyPage=null;
bodyPage = new DataOutputStream(connection.getOutputStream());
bodyPage.writeBytes(spaceBody );
bodyPage.close();
I receive Ok 200 as response but I can't see any space in confluence created with that name or key.
Does someone if I need to execute any further step?
Many thanks