When I get a list of issues from a search, how can I get the list of attachments for an issue? Using this code:
JiraRestClient c = j.create(new URI("https://issues.apache.org/jira/"), new AnonymousAuthenticationHandler()); IssueRestClient irc = c.getIssueClient(); Issue is = irc.getIssue(issueKey).get(); if (is == null || is.getAttachments() == null) return Lists.newArrayList(); return Lists.newArrayList(is.getAttachments());
is.getAttachments always returns null, even when there are attachments. And I don't see another way of asking for just the attachments for one issue. (Using version 2.0.0-m3).
Issue.getAttachments() is the way to go ... provided that there is attachment info sent by the server.
I think your problem is specific to JIRA instance side used by Apache.
I've just checked a few random issues which do have attachments and their REST representation does not include "attachment" information at all.
I don't recall any issue in JIRA itself about missing attachment info in REST representation of an issue. I've checked on some other instances (like JIRA 5.2.10) and there attachment info in REST is present.
I suppose this problem may be caused by some configuration issue or a mis-behaving plugin installed on issues.apache.org (AFAIK they used a plugin handling contributions (legal aspects) as issue attachments).
Hey Victor - no, didn't get this resolved, but as Wojciech points out, the problem isn't on the JRJC side, but instead on the API output itself (at least in my case). If you view the raw REST output in a browser and see that there's no attachments there, you're in the same boat. No idea how to resolve that, except maybe as an upgrade or settings change on the JIRA repo itself.
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG