Defect #20119
closedREST API: setting project_id in issue not accepted in Redmine 3.0.3
0%
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
       Updated by Alexander Muthmann over 10 years ago
      Updated by Alexander Muthmann over 10 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.
       Updated by Alexander Muthmann over 10 years ago
      Updated by Alexander Muthmann over 10 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.
       Updated by Go MAEDA over 10 years ago
      Updated by Go MAEDA over 10 years ago
      
    
    - Status changed from New to Closed
- Resolution set to Duplicate
According to #19276-8, it is expected behavior.
       Updated by Go MAEDA over 10 years ago
      Updated by Go MAEDA over 10 years ago
      
    
    - Is duplicate of Defect #19276: Creating new issues with invalid project_id should return 422 instead of 403 error added
       Updated by Go MAEDA almost 9 years ago
      Updated by Go MAEDA almost 9 years ago
      
    
    - Related to Defect #23766: API : creating issues with project identifier no longer possible added