최근 검색
최근 검색 없음
Uploading pdf file in base64 with API
2024년 2월 09일에 게시됨
Hi,
I'm trying to upload a pdf file with the API. I have the content in base64 format.
The file is created and added to the ticket, but Adobe Acrobat can't open it after download. The error says the file is corrupted.
The upload API is called with Content-type = "application/pdf;base64". I tried other content-types with the same result.
Any idea ?
Thanks
0
2
댓글 2개
Christelle Bertocchi
The file is ok when sent in binary format.
Thank you
0
Jakub
Hello Christelle Bertocchi
When using the Zendesk API to upload a file, the API expects the file to be sent as binary data in the request body rather than base64-encoded.
If you're setting the
Content-type
to"application/pdf;base64"
, it suggests that you're sending the data as base64 when the API is expecting raw binary data.If you have the PDF in binary format to start with, you can skip the base64 decoding and directly use the binary data in your API request. In this case, you need to ensure the following when making the API request:
Content-Type
header to"application/pdf"
as the server expects raw binary data of a PDF.0
댓글을 남기려면 로그인하세요.