Uploading attachments with the API



2023년 5월 17일에 게시됨

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? 

0

1

댓글 1개

Hey Shan,

What are you setting as the Content-Type?
 
Thanks!

0


댓글을 남기려면 로그인하세요.

원하는 정보를 못 찾으셨나요?

새 게시물