Uploading attachments with the API
I'm trying to upload a file using the API. I have the file as a base64 text from the client, and I'm first encoding it with `b64encode` and passing that result in as the data to the api. My request looks like this:
requests.post(api_url, params=params, data=file, headers=headers, auth=_get_auth()).json()
,where "file" is the binary file (the result of base64.b64encode)
I get a token back and use it to create a comment with this attachment, but when I try to download the attachment from the zendesk UI, it doesn't show up in the original form (PDF). It downloads up as the binary text file passed into the api. I know I've messed up the conversions somewhere, but I'm not sure where. Any tips?
-
Hey Shan,
What are you setting as the Content-Type?
Thanks!
댓글을 남기려면 로그인하세요.
1 댓글