Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

curl extract obtained from the confluence server is not getting parsed by python mjson.tool


I am using the below command to extract the data from the confluence server

curl -u user:"passkey" -X GET "" | 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


1 answer

1 accepted

0 votes
Answer accepted
Prince Nyeche Community Leader Nov 25, 2020

Hi @Nikhilesh Saggere 

Welcome to Community! If you're accessing via API endpoint from here , 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.

Hi Prince,

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

{"results":[{"id":"2064464","type":"page","status":"current","title":"FRANS Home","extensions":{"position":"none"},"_links":{"webui":"/display/~beq03163/Frans+De+Buys%27s+Home","edit":"/pages/resumedraft.action?draftId=2064464","tinyui":"/x/UIAf","self":""},"_expandable":


Please help, does it mean i am getting the output in JSON format?

Prince Nyeche Community Leader Nov 25, 2020

Hi @Nikhilesh Saggere 

This is the URL you should use instead, since that url works. so your request should be

 curl -u user:password -X GET " &limit=10&expand=space,history,body.view,metadata.labels" | python -m json.tool
Like Nikhilesh Saggere likes this

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?

/content?type=blogpost&start=0 &limit=10&expand=space,history,body.view,metadata.labels"

i.e, blogpost and space with actual names used in the confluence page.?

Prince Nyeche Community Leader Nov 25, 2020

This "space,history,body.view,metadata.labels" you do not need to change as you're expanding the json. if you need a specific page, use CQL "rest/api/content/search?cql=space=TEST" mentioned on Advanced searching

Thanks @Prince Nyeche It is working now.

Hey @Nikhilesh Saggere 

Glad to help out, if the above answers your question. Please accept the answer, so other users can see it as a solution.

Hi @Prince Nyeche 

I'm totally new to using rest api for confluence. Can you please help me with this



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

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...

177 views 0 6
Read article

Community Events

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

Events near you