I am using the below command to extract the data from the confluence server
curl -u user:"passkey" -X GET "https://confluence.sw.mycompany.com/pages/viewpage.action?pageId=127798346" | python -mjson.tool
This command though it extracts but while piping it to the python json format converter it is giving an error as show here:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 79367 0 79367 0 0 50295 0 --:--:-- 0:00:01 --:--:-- 50295
Expecting value: line 2 column 1 (char 5)
However if I redirect the output of the curl command to a text file, I get the html content.
Could you please help me resolve this error.
My assumption: The confluence server is returning a html output, which python is treating as a byte array instead of strings so it is giving this error.
Please check and let me know.
I have followed the example available here:
curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?type=blogpost&start=0 &limit=10&expand=space,history,body.view,metadata.labels" | python -mjson.tool
Welcome to Community! If you're accessing via API endpoint from here https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/ , the output should be in JSON and not HTML. However you should check the directory Confluence is installed, does yours say
or something else as "/confluence" is the directory where Confluence is installed on the Doc's example. if yours is a different directory, then you might want to change that in order to get the output. You can run a test of the URL on your Browser to see the output first, before attempting the curl extraction.
Thank you for your response!
I am a novice in the confluence programming, could you please elaborate where I have to check the installation of the confluence directory? Is it on the server? Because I have not installed the server by myself and it is taken care by the IT department in my organization (Who seems to have no clue on how to check this)
And also when I performed the following URL test on my browser
I get huge content like this
Please help, does it mean i am getting the output in JSON format?
This is the URL https://confluence.sw.mycompany.com/rest/api/content you should use instead, since that url works. so your request should be
curl -u user:password -X GET "https://confluence.sw.mycompany.com/rest/api/content?type=blogpost&start=0 &limit=10&expand=space,history,body.view,metadata.labels" | python -m json.tool
Thank you for this information.
If i understand correctly, the following fields which are there as part of the URL shall be replaced by the page that i am interested in, istn't?
i.e, blogpost and space with actual names used in the confluence page.?
Hi @Prince Nyeche
I'm totally new to using rest api for confluence. Can you please help me with this
Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond. A long time favorite, Team Cale...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events