I am trying to create a post an issue to redmine using their API. They say that I should use this format.
http://www.redmine.org/projects/redmine/wiki/Rest_api_with_ruby
Here is my code.
issue = Issue.new(
:subject => 'Feedback',
:assigned_to_id => 1,
:project_id => 1,
:description => $description,
:custom_field_values => {"6" => "Thomas"},
)
All the fields work fine, except for the last one named :custom_field_values. It won’t add the custom field when I run the script
When I check the server log the post request shows custom_field_values as a key of custom_field_values which prevents my import from working
This is the server log
Parameters: {"issue"=>{"assigned_to_id"=>1, "custom_field_values"=>
{"custom_field_values"=>{"6"=>"Thomas"}}, "description"=>"placeholder text",
"project_id"=>1, "subject"=>" Feedback"}}
When I created a ticket though the redmine interface the correct JSON looks like this.
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"}
Can anyone help me to see why I am getting that duplicated key with nesting? Same thing happens if I make up a random key.
I am using Bitnami Redmine 2.5 Ruby 2.0 Windows 7
require 'rubygems' require 'active_resource' require 'roo'