Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,907
Community Members
 
Community Events
168
Community Groups

create page "POST /wiki/rest/api/content/ HTTP/1.1" 415

Edited

Hi, 

I am trying to create page using python requests module and getting 415. 

here is my python function : 

def create_page(contenturlheaders):
    create_page = {        "type""page",        "title""test",        "space": {"key": space_key},        "ancestors": [{"id": parent_page_id}],        "status""current",        "body": {            "storage": {"value""This is a new page""representation""storage",}        },    }
    response = requests.post(contenturl, data=create_page, headers=headers)    print(response.status_code)

 

here are my headers: 

headers = {    "accept": "application/json",    "authorization": "Basic %s" % encoded,}

 

I do not see authorization is issue here because that i am able to make get content and delete page calls. I have tried adding "X-Atlassian-Token": "no-check" but still gets 415. My user also has full access to write and read.

 

any  help appreciated. 

 

Regards

Sukh

 

1 comment

There was an issue with body. It got resolved after providing body in html format. 

 

 "body": {            "storage": {"value""This is a new page""representation""storage",}        },    }

 

to 

 

"body": {            "storage": {"value": "<p>This is a new page</p>", "representation": "storage",}        },    }

Like Zak Laughton likes this

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Confluence

Watch 4 Confluence apps compete for Best App Demo in September's Appy Hours

Calling all collaborators! Appy Hours on the Atlassian Community is a monthly event where 4 Partner and app vendor presenters go head-to-head with 5-minute demos for the title of Best App Demo. I...

502 views 0 12
Read article

Atlassian Community Events