I have been following REST API documentation for Confluence, trying to create a new page, but still I have no new page in confluence and json decoder seems to be not working.
This is the command that I am using:
curl -u recovery_admin:qwerty -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"new page",
"space":{"key":"CM"},"body":{"storage":{"value":"<p>This is <br/> a new page</p>","representation":
"storage"}}}' http://localhost:8090/confluence/rest/api/content/ | python -mjson.tool
This is a confluence version that I use only for test purposes, and I am running curl from the same machine where confluence is hosted in port 8090. The space tag is CM.
With python (who uses python 2) or even python3 (who uses python 3), I am unable to encode curl outputs.
With python 2:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35507 0 35507 0 0 236k 0 --:--:-- --:--:-- --:--:-- 237k
No JSON object could be decoded
With python 3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35507 0 35507 0 0 225k 0 --:--:-- --:--:-- --:--:-- 225k
Expecting value: line 2 column 1 (char 5)
Without using python -json.tool I can see that I can get curl output data, but its hard do understand what may have occur. =/
Anyone knows what I am doing wrong to be unable to create the page in that space and why I am unable to decode in JSON?
I hate to say that "it works on my machine" because that's not really helpful.
So what does the raw output of the curl command look like ? any stack-traces in the logs ? and which version of Confluence are you running ?
I believe that it works on yours but you know how things work lol.
So, Confluence is at 7.0.1, and the raw output is here:
https://gist.github.com/failover88/6c234ed6e43e99e910ec3ecab06eff2c
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interesting, it redirects to the dashboard . but I see the following
```
<meta id="confluence-base-url" name="confluence-base-url" content="http://10.0.0.80:8090">
```
which suggests your instance is deployed at root context `/` instead of `/confluence` , so perhaps you're targeting the wrong endpoint with your command?
try with
http://localhost:8090/rest/api/content/
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.