Hi,
Iam trying to use the attachment macro to pull all the files that i have attached into the main page. But always getting an error.
My code is
headers1 = {'Content-Type': 'application/json'}
data1 = {"id":id,"type":"page","title":file,"space":{"key":"~CCala700000"},"body": {"storage": {"value": "<ac:structured-macro ac:name=\"attachments\"><ac:parameter ac:name=\"old\">false<\/ac:parameter> <ac:parameter ac:name=\"patterns\">.*xlsx<\/ac:parameter> <ac:parameter ac:name=\"sortBy\">name<\/ac:parameter> <ac:parameter ac:name=\"sortOrder\">ascending<\/ac:parameter><ac:parameter ac:name=\"labels\"><\/ac:parameter> <ac:parameter ac:name=\"upload\">false<\/ac:parameter> <\/ac:structured-macro>","representation":"storage"}},"container":{"id":id}}
r = requests.post('https://confluence.XXXX.com/rest/api/contentbody/convert/view/',data=json.dumps(data1),headers=headers1,auth=(username, password))
print(r.status_code)
print(r.text)
The error is 500 with the below message
{"statusCode":500,"data":"authorized":false,"valid":true,"errors":],"successful":false,"notSuccessful":true},"message":"com.atlassian.confluence.api.service.exceptions.ServiceException: java.lang.UnsupportedOperationException: Cannot convert from null to view"}
Even i post tried posting like the below but not successful. Iam trying this for the first time. Any help is much appreciated.
r = requests.post('https://confluence.XXXX.com/rest/api/content/',data=json.dumps(data1),headers=headers1,auth=(username, password))
print(r.status_code)
I get the below error. Do not know which one is correct
{"statusCode":400,"data":"authorized":false,"valid":true,"errors":],"successful":false,"notSuccessful":true},"message":"Error parsing xhtml: Unexpected character '\\' (code 92) in content after '<' (malformed start element?).\n at [row,col {unknown-source}]: [1,506]"}
Thanks.
Bhavani