Ricerche recenti
Nessuna ricerca recente
Uploading pdf file in base64 with API
Data ultimo post: 09 feb 2024
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 commenti
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
Accedi per aggiungere un commento.