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:
/rest/api/content/blueprint/instance/{draftId}
with POST method.