I wanted to piggy back on this post because I am also having trouble attaching a PDF file to an article to update a ticket. I’m able to make tickets with the API, but what specifically do you need to pass to tell the location/file path of the pdf I want to attach?
The documentation says it’s identical to “POST”, but I’m getting confused because it still seems like I need to provide the API with more data, like a file path?
Thank you for all the help in advance! I can provide more info if needed!
Here’s the Python code I’m using (Currently throwing 500 Internal Server Error). I may not be using the Requests or File objects correctly but any help on what I’m doing incorrectly would be greatly appreciated!!
update_params = {
"title": "update Test title",
"state": "open",
"priority": "2 normal",
"article": {
"subject": f"update Test subject {update_type}",
"body": "RMS Test body",
"internal": True
}
}
sl_file_obj = open(d['attachment'], "rb").read()
message_files = {'attachment': sl_file_obj}
response = requests.request("PUT", ticket_url, headers=zammad_headers, json=update_params, files=message_files)
Andrew
