Hi -
Below is the documentation I see for 'POST request to upload attachment'. Is there a groovy code, that is available for 'upload attachment' ?
Hi @Reeja Mathews welcome to the community. There is groovy code to achieve this and it is used within plugins such as Scriptrunner or Groovy for Jira. Do you have any of these plugins available to you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I tried the below. It says 200, but doesn't really attach anything to Jira, any idea where I might be going wrong ?
// ------- CODE --------
def args = [
httpMode : 'POST',
url : "https://<url name>/rest/api/2/issue/PEQT-234/attachments",
customHeaders: [
[maskValue: true, name: 'Authorization', value: "Basic xyz="],
[maskValue: false, name: 'X-Atlassian-Token', value: "no-check"],
[maskValue: false, name: 'Content-Type', value: "multipart/form-data"]
],
uploadFile : 'README.md',
wrapAsMultipart : true,
multipartName : 'README.md'
]
httpRequest args
// ------- CODE --------
I tried with content-type as 'application_json' too, but doesn't do an upload properly
fyi - masked the url name and the basic authorization
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.