我正在尝试使用他们的 API 创建一个发布问题以进行 redmine。他们说我应该使用这种格式。
http://www.redmine.org/projects/redmine/wiki/Rest_api_with_ruby
这是我的代码。
issue = Issue.new(
:subject => 'Feedback',
:assigned_to_id => 1,
:project_id => 1,
:description => $description,
:custom_field_values => {"6" => "Thomas"},
)
除了最后一个名为 :custom_field_values 的字段外,所有字段都可以正常工作。运行脚本时它不会添加自定义字段
当我检查服务器日志时,发布请求将 custom_field_values 显示为 custom_field_values 的键,这会阻止我的导入工作
这是服务器日志
Parameters: {"issue"=>{"assigned_to_id"=>1, "custom_field_values"=>
{"custom_field_values"=>{"6"=>"Thomas"}}, "description"=>"placeholder text",
"project_id"=>1, "subject"=>" Feedback"}}
当我通过 redmine 界面创建票证时,正确的 JSON 看起来像这样。
Parameters: {"utf8"=>"✓", "issue"=>{"is_private"=>"0", "tracker_id"=>"4",
"subject"=>"test", "description"=>"test", "status_id"=>"1", "priority_id"=>"4",
"assigned_to_id"=>"", "custom_field_values"=>{"3"=>"Web", "4"=>["Search", ""],
"5"=>"testeaf", "6"=>"sdfasdfadf", "7"=>"2014-09-30"}}, "commit"=>"Create",
"project_id"=>"testproject"}
谁能帮我看看为什么我会通过嵌套得到那个重复的键?如果我组成一个随机密钥,也会发生同样的事情。
我正在使用 Bitnami Redmine 2.5 Ruby 2.0 Windows 7
需要“rubygems”需要“active_resource”需要“roo”