Jira API Error when adding attachments

Matt Liu July 9, 2021

I'm using NodeJS to try to POST a file as an attachment to the /rest/api/3/issue/{issueIdOrKey}/attachments endpoint as shown here.

Using CURL inside the command line successfully POSTs the file to the desired issue but it fails to do so inside NodeJS.

I've tried the formdata library along with the https, axios, and node-fetch libraries all to no avail. Each time I format the request accordingly to how it's specified in the documentation and all are returning 404 or 500 errors. Here are the snippets of code I'm trying.

Errors I get:

{
message: 'null for uri: https://mydomain.atlassian.net/rest/api/3/cs-785/attachments',
'status-code': 404
}
500 Internal Server Error

Can anyone provide any insight to what I'm doing wrong or potential solutions? Thanks in advance.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events