【问题标题】:Jira API - Add attachmentJira API - 添加附件
【发布时间】:2016-07-25 09:36:17
【问题描述】:

用于 JIRA REST API 的 Ruby gem 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"

【问题讨论】:

  • using this gem for exist issue 是什么意思?
  • 编辑#1。 - 在 Jira 中创建问题; - 将文件添加到问题中。

标签: ruby-on-rails jira jira-rest-api


【解决方案1】:

这是我的解决方案

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

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

我希望这会有所帮助!) 完成

【讨论】:

    猜你喜欢
    • 2015-03-17
    • 2015-03-20
    • 2015-04-15
    • 1970-01-01
    • 1970-01-01
    • 2013-07-09
    • 1970-01-01
    • 1970-01-01
    • 2020-06-02
    相关资源
    最近更新 更多