Recent searches
No recent searches
Upload images (create-unassociated-attachment)
Posted Oct 23, 2023
I have been trying to upload images via the API to the Help Center as associated attachments. I have been looking at the developer resources, however the examples and the text does not appear to explain how the API is expecting to receive the file
I have looked at other Community posts but not seen the solution. Anyone any ideas?
Link to documentation I have been looking at:
Error:
{"errors":"No file provided"}
My Python:
url = "https://#removed#.zendesk.com/api/v2/help_center/articles/attachments"
headers = {
"Content-Type": "image/jpg",
}
file = open("1.jpg", "rb").read()
response = requests.post(
url,
data=file,
auth=(user, pwd),
headers=headers
)
print(response.text)
response_json = response.json()
print(response_json["id"],response_json["content_url"])
0
0
0 comments
Sign in to leave a comment.