Hi,
I need to remove the specific attachment.
The attachment was uploaded to many issues.
There is a REST API to remove attachments (Jira 8.20.8 (atlassian.com) but it needs the ID of the attachment.
How can we get the ID of the attachment? And does each same attachment in different issues has the same ID?
To get the ID of an attachment, you have to read the issue for its list of attached files. /rest/api/2/issue/(issue key)?fields=attachment should do it.
Attachment ids are all unique, irrespective of the file content and name, you'll need to read every issue that has been affected.
/rest/api/2/issue/<issue key>?fields=attachment
To list attachments as json.
Otherwise if you hover over attachment on view, it lists the ID in the url e.g.
/secure/attachment/2407901/myattachmentname.png
Attachments are unique to issues, and are stored for each issue in separate directory in the backend, with unique ids.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I have the file name, how can i extract its attachment ID?
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 can get your attachment id with the web request https://xyz.atlassian.net/rest/api/3/issue/{{issue.key}}
{{webResponse.body.fields.attachment.id}} - This will give you all the attachment id's on the issue.
{{webResponse.body.fields.attachment.id.max}} - This will give you latest attachment id on the issue.
You can use the below web request to extract attachment using attachment id
https://xyz.atlassian.net/rest/api/3/issue/attachment/{{AttachmentID}}
Hope this helps !
Vijay
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.