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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,591 views 7 30
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you