Defect #20119

REST API: setting project_id in issue not accepted in Redmine 3.0.3

Added by Alexander Muthmann over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:REST API
Target version:-
Resolution:Duplicate Affected version:3.0.3

Description

Hi all,

I hope this is a mistake on my side but as far as I understand this might also be a bug in redmine.

If I try to post a new issue via the api to https://myredmine/issues.json I would use the following payload according to the documentation (http://www.redmine.org/projects/redmine/wiki/Rest_Issues):

{"issue": {
  "subject": "Test subject",
  "project_id": "myProject",
  "description": "foobar" 
  }
}

Redmine now does not create the ticket but responses with a 422 and

{"errors":["Project cannot be blank","Tracker cannot be blank","Status cannot be blank"]}

After some testing I found a working payload:

{"issue": {
  "subject": "Test subject",
  "description": "foobar" 
  },
  "project_id": "myProject" 
}

My Environment:

Environment:
  Redmine version                3.0.3.stable
  Ruby version                   2.1.2-p95 (2014-05-08) [x86_64-linux]
  Rails version                  4.2.1
  Environment                    production
  Database adapter               Mysql2

The issue does not show up on a 2.5.1 installation (both payloads work flawless):

Environment:
  Redmine version                2.5.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [i486-linux]
  Rails version                  3.2.6
  Environment                    production
  Database adapter               Mysql2


Related issues

Related to Redmine - Defect #23766: API : creating issues with project identifier no longer p... Closed
Duplicates Redmine - Defect #19276: Creating new issues with invalid project_id should return... Closed

History

#1 Updated by Alexander Muthmann over 2 years ago

I found a quick fix for me here:

in issues_controller.rb I reintegrated the method find_project and it's call in before_filter. This was removed in r13999
Most likely this is not the preferred way to solve it but this works as a quick fix for me.

#2 Updated by Mischa The Evil over 2 years ago

Please see #19276.

#3 Updated by Alexander Muthmann over 2 years ago

Thank you for this hint. I assume the change will be permanent and the calls to the api have to be changed to the "new" format.

#4 Updated by Go MAEDA over 2 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

According to #19276-8, it is expected behavior.

#5 Updated by Go MAEDA over 2 years ago

  • Duplicates Defect #19276: Creating new issues with invalid project_id should return 422 instead of 403 error added

#6 Updated by Go MAEDA about 1 year ago

  • Related to Defect #23766: API : creating issues with project identifier no longer possible added

Also available in: Atom PDF