John
John

Reputation: 443

How to download attachments from JIRA v6.3.15 in java

I'm trying to get list of JIRA issues created after a given date and download the respective attachment files from my application in java. The JIRA Server version I am currently using is 6.3.15.

When I searched on web I found the below REST client, however it says it supports till JIRA Server 6.0. I want to know whether it supports 6.3.15 as well, if not are there any other alternate solutions?

REST Java Client for JIRA by Atlassian Labs for JIRA Server 5.0 - 6.0

https://marketplace.atlassian.com/plugins/com.atlassian.jira.jira-rest-java-client

Upvotes: 1

Views: 3306

Answers (1)

Volodymyr Krupach
Volodymyr Krupach

Reputation: 918

REST Java Client for JIRA is a wrapper around JIRA REST https://docs.atlassian.com/jira/REST/6.3.15/. I see that there was no changes in attachment REST methods between 6.0 and 6.3.15. Take the current version and I am sure it will work for you.

Another way is to directly use JIRA REST API and in your case it can be even simpler. I guess you need:

For each issue there will be a section with attachments:

        "attachment": 
    [
      {
        "self": "https://vkrupach.atlassian.net/rest/api/2/attachment/10100",
        "id": "10100",
        "filename": "to test",
        "author": 
        {
          "self": "https://vkrupach.atlassian.net/rest/api/2/user?username=vkrupach",
          "name": "vkrupach",
          "key": "vkrupach",
          "emailAddress": "[email protected]",
          "avatarUrls": 
          {
            "48x48": "https://vkrupach.atlassian.net/secure/useravatar?avatarId=10122",
            "24x24": "https://vkrupach.atlassian.net/secure/useravatar?size=small&avatarId=10122",
            "16x16": "https://vkrupach.atlassian.net/secure/useravatar?size=xsmall&avatarId=10122",
            "32x32": "https://vkrupach.atlassian.net/secure/useravatar?size=medium&avatarId=10122"
          },

          "displayName": "Volodymyr Krupach [Administrator]",
          "active": true,
          "timeZone": "Europe/Moscow"
        },

        "created": "2015-04-19T10:05:59.696+0300",
        "size": 469,
        "mimeType": "text/html",
        "content": "https://vkrupach.atlassian.net/secure/attachment/10100/to+test"
      }
    ]
  • "content": is direct link to file.

Upvotes: 5

Related Questions