mix-fGt
mix-fGt

Reputation: 487

Jira API - Add attachment

A Ruby gem for the JIRA REST API https://github.com/sumoheavy/jira-ruby

How to add one or more attachments to an issue.

EDIT #1

JIRA REST API: Issue attachments

Any suggestions about it?

EDIT #2

I figured out how to save some attachment but with curl only.

curl -D- -u "username:password" -X POST -H "X-Atlassian-Token: no-check" -F "file=@tmp/1.jpg" "https://jira.you_end_point/rest/api/2/issue/"issue-ID"/attachments"

Upvotes: 2

Views: 980

Answers (1)

mix-fGt
mix-fGt

Reputation: 487

This is my solution

rest-client gem

require 'rest-client'
resource = RestClient::Resource.new(url, username, password)
response = resource.post({ file: File.new(path)}, { "X-Atlassian-Token" => "nocheck"} )
response.code.eql?(200) # ok status ;)

After this you probably need to delete local file..

I hope this will help!) done

Upvotes: 2

Related Questions