Facing issues with downloading an attachment from Jira account using the JIRA Cloud REST API

e508user March 22, 2018

I have a C# application developed using ASP.NET MVC framework. The application uses the JIRA Cloud API for integrating with JIRA and using some of the JIRA functionality like creating/updating issues, changing the issue status and downloading the issue attachments. Recently I upgraded the JIRA API version from 5.5.1 to 10.2.1. I am using basic authentication for connecting to JIRA.

Jira jiraConn = Jira.CreateRestClient(m_JiraUrl, m_Username, m_Password);

Using the jiraConn object, I can fetch all the data that I require like issues and attachments. I get the attachment object using

Issue issue = jiraConn.Issues.GetIssueAsync(issueKey).Result;

IEnumerable<Attachment> attachments = issue.GetAttachmentsAsync().Result;

Attachment file = attachments.OrderByDescending(f => f.CreatedDate).First();

which works fine.

However when I try to download the actual attachment using

file.Download(path);

the process does not complete. It starts downloading the attachment because a file is created in the given path. It takes a few minutes(which is unusual) for the file to get populated with partial data. However, the process does not complete because the download method never returns and is stuck trying to complete the process of fetching the entire data. I suspect there is something that is blocking the download method, but I cannot figure out what exactly. Any help with this issue is highly appreciated.

1 answer

0 votes
QDappnet April 16, 2018

I just tested using Atlassian.SDK 10.2.1 by Federico Silva Armas and I could be able to download from my JIRA Cloud instance without any issue. Pretty much same codes that you are using.
1. Try to download from a different issue
2. Create a simple app with same codes and test it

Suggest an answer

Log in or Sign up to answer