Retrieving list of attachments associated with an issue via activeresource / ruby
Added by Josh Miller about 10 years ago
I am writing a ruby script to query redmine for issues with a specific status, download the attachments associated with that issue, and submit them to another queue for processing. I am not able to find a list of attachments without querying the database directly and I am wondering if there is a way using the REST API via active_resource to get an issue, then get a list of attachments.
Environment:
Redmine version 2.4.3.stable
Ruby version 1.9.3-p484 (2013-11-22) [x86_64-linux]
Rails version 3.2.16
Environment production
Database adapter Mysql2
I've tried to use the include attachments flag when querying issues and I don't get anything back beyond what I would get when not using that flag:
issues = Issue.find( :all, :params => { :status_id => "64", :include => "attachments" } )
issues.each do |issue|
puts issue.inspect
end
I get a 200 OK in the logs when performing this request.
Is there a way to retrieve attachments using information from the issue itself, or with the issue? Is there a better way to do this?
Thanks a lot,
Josh