Hi this is my sample code to test adding a new page.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://*******.atlassian.net/wiki/rest/api/content/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"type":"page","title":"inserttitle","space":{"key":"insertspace"},"ancestors":[{"type":"page","id":insertancestor}],"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "myemail" . ":" . "mykey");
$headers = array();
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
it gives me an error:
string(316) "{"statusCode":500,"message":"org.codehaus.jackson.JsonParseException: Unexpected character ('i' (code 105)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: com.atlassian.plugins.rest.common.limitrequest.jersey.LimitingRequestFilter$1@2305a82c; line: 1, column: 102]"}"
Any ideas what the issue is?
Thanks
Ok so I have resolved this:
insertspace
is not the name of a space on my instance of Confluence.
I changed it to a valid space name and it worked.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.