Here's my command:
curl -u fvila:"password" -X POST -H "Content-Type: application/json" --data "@data1.json" --url http://localhost:8090/confluence/rest/api/content/
I'm was getting this response from the api:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 34604 0 34604 0 0 389k 0 --:--:-- --:--:-- --:--:-- 392k
Expecting value: line 3 column 1 (char 6)
Now using the Confluence password, instead of a generated token, it's as follows:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 827 100 697 100 130 18473 3445 --:--:-- --:--:-- --:--:-- 22351
Expecting value: line 1 column 1 (char 0)
(100% received and 100% Xferd, but error on line 1 column 1 instead of line 3 column 1 )
here's the content of data1.json:
{
"type":"page",
"title":"new page",
"space":{"key":"TC"},
"ancestors": [ {"id": "360452" }],
"body":"<p>This is <br/> a new page</p>"
}
When I remove the `| python -mjson.tool`, I get a full http page response, including:
<div id="footer" role="contentinfo">
<section class="footer-body">
<p class="license license-eval">
<strong>EVALUATION LICENSE</strong>
Are you enjoying Confluence? Please consider <a href="https://www.atlassian.com/purchase/product/confluence-data-center">purchasing it</a> today.
</p>
<ul id="poweredby">
<li class="noprint">Powered by <a href="http://www.atlassian.com/software/confluence" class="hover-footer-link" rel="nofollow">Atlassian Confluence</a> <span id='footer-build-information'>7.13.8</span></li>
<li class="print-only">Printed by Atlassian Confluence 7.13.8</li>
<li class="noprint"><a href="https://support.atlassian.com/help/confluence" class="hover-footer-link" rel="nofollow">Report a bug</a></li>
<li class="noprint"><a href="https://www.atlassian.com/company" class="hover-footer-link" rel="nofollow">Atlassian News</a></li>
</ul><div id="footer-logo"><a href="http://www.atlassian.com/" rel="nofollow">Atlassian</a></div>
</section>
</div>
I've now solved my problem by using the atlassian-python-api with python, explained here:
https://github.com/atlassian-api/atlassian-python-api
I still don't know why it didn't work with curl...
I don't know whether to accept this answer as good, as it doesn't really answer the question as I asked it, and may not be useful for people who are specifically looking to make the curl command work, and had the same problem as I did.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.