Hello
I am trying to send a file as attachment using Jira Rest API, I am doing this from inside the electron and I am doing the following:
I am setting the request (Post):
var XMLHttpRequest = require('xhr2');
var xhr = new XMLHttpRequest();
xhr.open("POST","myInstance/rest/api/2/issue/ticketid?attachements",true);
xhr.setRequestHeader("Authorization","Basic"+Buffer.from("myUserName"+":"+"myToken").toStrin("base64"));
let file = "file=@'D:\\Testing Jira API\\testing.txt";
xhr.send(file);
xhr.onload = function (){ console.log("the statues is ", status);
and I am getting status 405 (method is not allowed)
also I tried :
let file = new File(["hello", new TextEncoder().encode("world.txt")],"hello.txt);<br>//using web-file-polyfilland it didn't work
My question is what is the best approach to attach a file using Jira Rest API ?