Hi,
I am trying to create page using python requests module and getting 415.
here is my python function :
def create_page(contenturl, headers):
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
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",} }, }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.