I’m trying to use the API to attach a file to a ticket. I have tried images and PDFs. The file gets attached to the ticket but is broken when viewed in Freshservice. When I get the ticket attachment details using the API, the attachment content-type is “application/octet-stream” instead of “image/jpeg” for the jpg image I tested but correctly set as “application/pdf” for the PDF I tested. But neither file types work correctly. Image is broken, PDF document is blank.
The file size, according to Freshservice, is always some bytes larger than they actually are locally. For example, with a very small image that is 1252 bytes locally, Freshservice reports the size as 1702 bytes. Here is the example payload for the small image I’m testing with:
--------------------------S1SJJcLLQQJrNanXChw123
Content-Disposition: form-data; name="attachments[]"; filename="test1.jpg"
Content-Type: image/jpeg
????JFIF?????ExifMM*?i&?\?p??52??522024:05:04 11:22:402024:05:04 11:22:40???http://ns.adobe.com/xap/1.0/
2024-05-04T11:22:40.520
??C
%# , #&')*)-0-(0%()(??C
(((((((((((((((((((((((((((((((((((((((((((((((((((??
"??
???}!1AQa"q2???#B??R??$3br?
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz???????????????????????????????????????????????????????????????????????????
???w!1AQaq"2?B???? #3R?br?
$4?%?&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz?????????????????????????????????????????????????????????????????????????????????m-????+?????v???"
?y?s?QEr?Y?D???e?G??
--------------------------S1SJJcLLQQJrNanXChw123
Content-Disposition: form-data; name="priority"
1
--------------------------S1SJJcLLQQJrNanXChw123--
And what Freshservice API returns for this image in the ticket:

I’m using Coldfusion to work with the API. Everything else I’m doing with the API (including downloading attachments) works fine, I’m just stuck trying to update a ticket with attachments. Anyone have any ideas on what to try?