Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Response 403: Could not create content with type page

Borja Bruno
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 23, 2019

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. 

1 answer

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 28, 2019

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:

  • The space that the content is being created in does not exist.
  • If the requesting user does not have permission to create content in it.

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events