Content
Updated by Jay Kay over 10 years ago
Hi, I’m trying to add a Work Package via JSON using API v2.
Once the Work Package is created (successfully), the query is redirected (via HTTP 303) to the newly created Work Package.
However, the redirection is to the XML format, rather then the JSON format of the GET request. Below is the log output:
Started POST "/api/v2/projects/test-project/planning_elements.json?key=6a5031cb58e26847472af3021fe5ab5a2e71a216" for 192.168.1.1 at 2014-04-07 16:30:20 +0200
Processing by Api::V2::PlanningElementsController#create as JSON
Parameters: {"planning_element"=>{"description"=>"", "status_id"=>1, "priority_id"=>2, "child_ids"=>nil, "assigned_to_id"=>nil, "responsible_id"=>nil, "fixed_version_id"=>nil, "subject"=>"Test Dysfonctionnement 4", "type_id"=>2, "parent_id"=>nil, "estimated_hours"=>nil, "author_id"=>6, "project_id"=>70}, "key"=>"6a5031cb58e26847472af3021fe5ab5a2e71a216", "project_id"=>"test-project"}
WARNING: Can't verify CSRF token authenticity
OpenProject User: OpenProject Admin (admin ID: 1 <enviesudest@envie.org>)
Redirected to http://envielyon.org:8080/api/v2/projects/test-project/planning_elements/82.xml
Completed 303 See Other in 48.7ms (ActiveRecord: 11.7ms)
Started GET "/api/v2/projects/test-project/planning_elements/82.xml" for 192.168.1.1 at 2014-04-07 16:30:20 +0200
Processing by Api::V2::PlanningElementsController#show as XML
Parameters: {"project_id"=>"test-project", "id"=>"82", "planning_element"=>{}}
Filter chain halted as :check_if_login_required rendered or redirected
Completed 401 Unauthorized in 2.7ms (ActiveRecord: 0.6ms)
Once the Work Package is created (successfully), the query is redirected (via HTTP 303) to the newly created Work Package.
However, the redirection is to the XML format, rather then the JSON format of the GET request. Below is the log output:
Started POST "/api/v2/projects/test-project/planning_elements.json?key=6a5031cb58e26847472af3021fe5ab5a2e71a216" for 192.168.1.1 at 2014-04-07 16:30:20 +0200
Processing by Api::V2::PlanningElementsController#create as JSON
Parameters: {"planning_element"=>{"description"=>"", "status_id"=>1, "priority_id"=>2, "child_ids"=>nil, "assigned_to_id"=>nil, "responsible_id"=>nil, "fixed_version_id"=>nil, "subject"=>"Test Dysfonctionnement 4", "type_id"=>2, "parent_id"=>nil, "estimated_hours"=>nil, "author_id"=>6, "project_id"=>70}, "key"=>"6a5031cb58e26847472af3021fe5ab5a2e71a216", "project_id"=>"test-project"}
WARNING: Can't verify CSRF token authenticity
OpenProject User: OpenProject Admin (admin ID: 1 <enviesudest@envie.org>)
Redirected to http://envielyon.org:8080/api/v2/projects/test-project/planning_elements/82.xml
Completed 303 See Other in 48.7ms (ActiveRecord: 11.7ms)
Started GET "/api/v2/projects/test-project/planning_elements/82.xml" for 192.168.1.1 at 2014-04-07 16:30:20 +0200
Processing by Api::V2::PlanningElementsController#show as XML
Parameters: {"project_id"=>"test-project", "id"=>"82", "planning_element"=>{}}
Filter chain halted as :check_if_login_required rendered or redirected
Completed 401 Unauthorized in 2.7ms (ActiveRecord: 0.6ms)