Forums

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

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

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