Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 http request returning bad/illegal format or missing URL for REST Api Edited

I am creating a script in python that can gather data from an atlassian confluence wiki page through an http request using the curl command. The confluence website I am trying to access is maintained by my company's server. The command I am currently using is:

curl -v -w -u admin:admin | python -mjson.tool

In place of admin:admin I type my username which is my email then a colon and my password so for eg. I know that the link is correct as when I click "" it directly takes me to the page which gets displayed in a JSON format with all the information but when I try to enter that command in the terminal I get an error saying. 

confluence server error.png

How should I securely authenticate to my company's confluence page through the terminal and eventually through my Python script?

1 answer

0 votes
Andy Heinzer Atlassian Team Apr 12, 2021


I understand that you are using the REST API to try to extract some json data from Confluence, but that this is not working as expected here.  I believe I know why this happening now.

The output of your curl by itself (without the pipe) tends to show some additional lines of output that are not really json.   In this case, since you appear to be looking to format that output, we need to tell Confluence that we are wanting specific content type (json).  Also using the -v switch provides a more verbose output than is usually wanted, unless you have to debug some aspect of the connection.  With that in mind, try this instead:

curl -u admin:admin -H "Content-Type: application/json" | python -mjson.tool

As for securely authenticating these REST calls, OAuth is the recommended means to do this, but it is considerably more complex to setup than a basic auth is. 

An alternative to OAuth would be to use a personal access token, this is not as secure as OAuth, but is more secure than just using a password and less complex than configuring OAuth.  As a side note about personal access tokens: These have only recently been made available to Server and Data Center editions of Jira (8.14 and higher) and Confluence (7.9 and higher).  Atlassian Cloud has had API Tokens for quite a while longer.  But in the case of using a python script, I'd suggest a personal access token if your version of Jira/Confluence supports it.

I hope this helps.


Suggest an answer

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

🥓🙅🏻‍♀️ Meet-less May Badge!

Hello Confluence Community!  What if i told you that you could have a healthier life and be 100% meet-less? This month, we're promoting a healthy, balanced work diet with Confluence. (Read m...

610 views 4 26
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