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

How to create a child page in confluence cloud using API

Ramachandran Gunasekaran April 14, 2023

When I tried to create a page using api, I am getting below error.

Error creating new child page: {"statusCode":400,"message":"com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.atlassian.confluence.api.model.content.ContentType` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (com.atlassian.plugins.rest.common.limitrequest.jersey.LimitingRequestFilter$1); line: 1, column: 2237] (through reference chain: com.atlassian.confluence.api.model.content.Content[\"type\"])"}

code Snippet:

api_url = 'https://domain.atlassian.net/wiki/rest/api/content/'

page_properties = {
'type': {"id": "page"},
'title': title,
"space": {"id": "593470626", "key": "Information Security"},
'ancestors': [{ 'id': parent_id }],
'body': { 'storage': { 'value': body, 'representation': 'storage' } }
}

payload = json.dumps(page_properties)

headers = { 'Content-Type': 'application/json' }
auth = (username, password)

response = requests.post(api_url, data=payload, headers=headers, auth=auth)

if response.status_code == 200:
print('New child page created successfully.')

1 answer

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 15, 2023
Ramachandran Gunasekaran April 17, 2023

I am able to create it using confluence python package

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events