We have created a Zendesk application, and we need to upload an image and use the response ID in the side conversation mail API.
We have implemented the Zendesk Attachment API and are familiar with how it works. We have tested the side conversation attachment API in POSTMAN, and it works fine. However, when we try to use the same API in our Zendesk application using the Client. Request API call, we encounter the following error. We have tried multiple things like changing the content type and debugging the uploaded file data but nothing works. Please take a look at the screenshot and sample code provided.
Following ENDPOINT we are referring: https://developer.zendesk.com/api-reference/ticketing/side_conversation/side_conversation_attachment/
https://developer.zendesk.com/api-reference/ticketing/side_conversation/side_conversation/

function uploadImage() {
let files = document.getElementById("mail-body-input").files;
const fileToUpload = files[0];
const formData = new FormData();
formData.append("file", fileToUpload);
client.request({
url: `/api/v2/tickets/side_conversations/attachments.json`,
method: "POST",
contentType: "multipart/form-data", // Let the browser set the content type with boundary
body: formData,
redirect: "follow"
})
.then((response) => {
console.log("Image uploaded successfully", response);
})
.catch((error) => {
console.error("Error uploading image", error);
});
}
Hmm that is odd behavior. Out of curiosity, how long is the file name that you're using?