Hi all¡
I am having a 403 response when a Python code tries to create a child page in Confluence.
We are using the following Python code that runs daily in Jenikns at 7.15 that creates a child page with our daily tasks so the team can tick them.
page_date = date.today().strftime("%Y-%m-%d")
due_date = page_date
page_title = 'operations_daily_tasks_'+ page_date
space_key = 'TO'
ancestor_id = 7475431
task_list = [
{"task_id": "1",
"task_text": "Download List of Shorts from Matrix - See: ",
"task_link": '"https://cygnus-am.atlassian.net/wiki/spaces/OP/pages/46628871/Locates+Request+MS"',
"task_link_text": "Procedure",
"task_due_date": due_date,
"task_user_id": users['borja']
},
{"task_id": "2",
"task_text": "Check the Web Portal - See: ",
"task_link": '"https://cygnus-am.atlassian.net/wiki/spaces/OP/pages/1078853868/Check+the+Web+portal"',
"task_link_text": "Procedure",
"task_due_date": due_date,
"task_user_id": users['borja']
},
page_data = create_task(page_title, space_key, ancestor_id, task_list)
r = requests.post('https://cygnus-am.atlassian.net/wiki/rest/api/content',
data=json.dumps(page_data),
auth=('admin', 'THE PASSWORD'),
headers=({'Content-Type':'application/json'}))
I have checked that the problem is not coming from space key, ancestor id neither task_list.
I think it is related with auth. This code was created by I worker that left the company.
Please note I am Admin in Confluence and I have permissions for creating, editing and deleting in any space.
Any help is appreciated as I am desperate to have this issue solved.
Hello Borja,
From reviewing your very detailed steps and python snippets everything looks to be in order, and the fact you’re getting a 403 message means you’re very close. 403 for Confluence cloud mean two things are possible:
I did notice within your POST call that you have Password specified. To clarify, you should use an API token instead of a password. If you’re not already doing this, please see the following to issue yourself an API token: API tokens.
The other issue could be an issue with the space the content is to be created in. Please ensure the SpaceID or Space Key is accurate and does belong to the space. Since you’ve already checked this then this may not be the issue.
Please do let us know if one of the two reported issues helped to resolve your page creation problem.
Regards,
Stephen Sifers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.