I am developing an external application built with React/Node and attempting these JIRA api calls over on my server with the fetch library.
So I am facing some issues when attempting to creating attachments onto issues via the JIRA API with:
/rest/api/2/issue/CCT-33/attachments
I am getting the error with the code I have left below
[Symbol(Response internals)]:
{ url: 'https://****/com/rest/api/2/issue/CCT-33/attachments',
status: 500,
statusText: 'Internal Server Error',
headers: Headers { [Symbol(map)]: [Object] } } }
I am able to create issues with the api just fine and also able to use curl to place those attachments:
curl -D -k -u ***/**** -X POST -H "X-Atlassian-Token: nocheck" -H "Content-Type: multipart/form-data" -F "file=@/Users/****/Desktop/Aerial06.jpg;type=image/jpg" https://*******/rest/api/2/issue/CCT-33/attachments`;
My hope though is to be able to use fetch (or whatever request library that is up the challenge) to be able to make these jira api calls from my server.
Here's a gist of all the files associated for this
--express server (with some crazy commented out attempts) :
https://gist.github.com/cjorda15/beddc0be91c8dac291ce3a0a76109621
-- helper file that makes the call from the client side to the server with new FormData being sent (it is being found on my server with multer)
https://gist.github.com/cjorda15/9dd772647eb4b6f81b4cc19991bb773d
I have attempted to mess with headers: Content-Type set to multipart/form and multipart/form; boundary=***** and the latter one actually got a 200 response, but no attachment was found.
Sorry if I sound like a noob with any of this.
Got it working by removing the content type in the header and then having the form/multipart made again after multer did its thing. Clearly need to avoid doing that both on the client and server side
const form = new FormData();
form.append('file', fs.createReadStream(req.files[0].path));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.