You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
SOLVED: Found out that I needed to use the space code instead of its actual name when creating the confluence page.
I have been trying to figure out for hours how to use the Atlassian Python API to do anything in Confluence, and I just can't for the life of me figure out how to authenticate. According to this documentation of the API, I should be able to do this
confluence = Confluence( url='http://localhost:8090', username='admin', password='admin')
But it just doesn't work. Another option it gives is a key/cert authentication and I can't figure out how to set that up, and another option is Oauth, and I've looked at probably 5 different pages trying to figure out how to enable that somehow but nothing tells me where the setting is.
I'm just so lost. Any help would be greatly appreciated. Thank you.
Hello Daniel, welcome to the Community!
I'm glad you were able to sort this question out and get the python library working with your local Confluence Server instance. We're here to answer any additional questions if they come up!
Cheers,
Daniel | Atlassian Team
Hi,
Can you please provide the example/answer. I am not able to figure out how to authenticate using the api?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It turned out that the confluence function I used in my original question wasn't the actual problem for me. What it turned out was that in the create function, I was using the actual name of the space for the space name argument, when it actually needed the three-digit code for the space. So for example my space name was "Test", but its code was "TES". I had been using "Test" for the space name but I needed to use "TES".
If this isn't your problem, then I can tell you that another problem I had, which was figuring out what to use for the confluence function that is shown in the original question. For username, use your email. For password, use an API token.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Daniel for your response!
I tried using the below mentioned to get authenticated to the confluence page and extract the information.
# coding=utf-8
from atlassian import Confluence
confluence = Confluence(url="http://confluence.companyname.com", username="user1", password="passkey")
# If you know Space and Title
content1 = confluence.get_page_by_title(space="SPACE", title="page title")
print(content1)
# If you know page_id of the page
content2 = confluence.get_page_by_id(page_id=1123123123)
print(content2)
However, i get the following error, when the above snippet is executed
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: for url: https://confluence.sw.companyname.com/rest/api/content?start=0&limit=1&spaceKey=SPACE&title=title
Going by the error code 401; it is still an authentication failure.
From https://community.atlassian.com/t5/Confluence-questions/No-more-Python-API-working-for-Confluence/qaq-p/1075027 the API token method is the only way forward.
Could you please provide me an example or point me to the code snippet where the API method is used to get the authentication step passed and able to extract the info.
I have generated the API key, but not sure how to use it the atlssaina-python API methods.
Please help.
Many Thanks!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there, a few of us at Atlassian would love to learn about how you use "space settings" functionality in Confluence. A facelift to the space settings is long overdue and we want to start with impro...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.