Jira API - 添加附件

Jira API - Add attachment

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

如何向问题添加一个或多个附件。

编辑#1

JIRA REST API: Issue attachments

有什么建议吗?

编辑 #2

我想出了如何保存一些附件但仅使用 curl。

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"

这是我的解决方案

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 ;)

之后你可能需要删除本地文件..

希望对您有所帮助!) 完成