Hello, I'm trying to create a python script that creates a page from existing template in Confluence, but I get 500 Server Error: Internal Server Error.
Could someone point out where I'm doing wrong in my following code?
#!/usr/bin/python
# coding: utf-8
import requests
BASE_URL = "https://xxxx.xxxxx.com"
HEADERS = {"content-type": "application/json"}
AUTH = ("myConfluenceUser", "myConfluencePassword")
def create_draft_page(draftId, pageTitle, spaceKey):
# Use HTTP method POST
response = requests.post(
BASE_URL + "/rest/api/content/blueprint/instance/" + draftId,
auth=AUTH,
params={"title": pageTitle, "spaceKey": spaceKey},
headers=HEADERS)
response.raise_for_status()
return response
def main():
print "-------------- start --------------------"
draftId = "12345678" # An existing draft id for template
create_draft_page(draftId, "My Page Title", "Space Name")
print "-------------- end ----------------------"
if __name__ == "__main__":
main()
I am using a following page as my reference.
https://docs.atlassian.com/atlassian-confluence/REST/5.9.6/#d3e392
It says the request format as:
with POST method.
Could anyone can help me?
I tried using curl to do the same thing above, but with no luck...
curl -X POST -H "Content-Type: application/json" -o myoutput -u user:password http://xxxx:xxxx/rest/api/content/blueprint/instance/12345678
Above will give me the following error.
{"statusCode":500,"message":"java.io.EOFException: No content to map to Object due to end of input"}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.