Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to attach a pdf file to the confluence from local and also tmp folder

shiva ram ch
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 31, 2023

when I am trying to attach a pdf file to the confluence page from local and also /tmp/name.pdf folder through api. It is throwing 500 error for tmp folder and FileNotFoundError: [Errno 2] No such file or directory from local .the lambda code below which I tried

 

def lambda_handler(event, context):

url = 'https://your-domain.atlassian.net/wiki/rest/api/content/pageid/child/attachment'

headers = {'Accept': '*/*', 'Authorization': 'Basic auth','Content-Type': 'multipart/form-data', 'X-Atlassian-Token': 'nocheck'}

data = {"comment": "This is War-Report"}
files={'file': open(r'C:\Users\***\Downloads\name.pdf', 'rb')}

#files={'file': open('/tmp/name.pdf', 'rb')}  ###(saved the pdf file from s3 to /tmp folder)

response = requests.post(url, headers=headers, verify=False, data=data, files = files)
print(response)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events