Need help with sending attachments over API having only a base64 string and some metadata in hands

Hi there!

I’m a Jira Cloud user and I’m trying to send attachments over API using Retool ( Retool has a native integration with Jira but it’s not working for some time now and we decided to integrate everything ourselves using API calls.

I’ve hit a wall while trying to add new attachments to existing tickets using this endpoint here:

When I have the file locally, everything works normally and the attachment is sent to the ticket. The issue happens when I’m trying to do that same procedure over Retool. Basically, Retool gives me a components to attach files and then I can access those files inside an object generated by them.

A simple “test.txt” with only “Test” written inside will generate this object to me:

  name: "text.txt",
  size: 4,
  lastModified: 1658779509760,
  type: "text/plain",
  value: "VGVzdA==",

The key “value” is the attachment’s base64 value.

I’ve tried sending the request using the base64 value, a binary generated from the base64 value, a buffer generated from the base64 value, and multiple other things, with no success. I get a 200 OK but the data object is not populated and the attachment is not attached to the ticket.

I’m using Javascript and some of the things mentioned above were done using FormData, fs, Buffer and other similar libs. Nothing is working unfortunatelly.

Any clues on how I can create a valid form-data body using JS having only that type of object in hands, please?

Thank you in advance! Any help is appreciated! :slight_smile: