Defect #6373

Can't Set author_id When Creating New Issue Through REST API

Added by Scott Doerrfeld about 10 years ago. Updated over 7 years ago.

Status:ClosedStart date:2010-09-12
Priority:NormalDue date:
Assignee:-% Done:

0%

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

Description

I have a web form on a separate site that I have been using with the REST API to create new issues successfully. I have only one problem: when using the REST API as shown below, it appears to not use the author_id that I define. Instead, the new issue always ends up having author_id set to the id of the user that is authenticating with the API.

  1. Issue model on the client side
    class Issue < ActiveResource::Base
    self.site = 'http://redmine.server/'
    self.user = 'foo'
    self.password = 'bar'
    end

issue = Issue.new(
:subject => 'REST API',
:assigned_to_id => 1,
:project_id => 1,
:author_id => 4 <--- this gets overwritten by id of 'foo'
)

Is setting the author_id not allowable from the REST API or am I missing something? I also tried changing the user and password dynamically with each new request (i.e. issue.user => 'user', issue.password => 'password' before issue.save gets called), without success.


Related issues

Related to Redmine - Feature #1739: Add ability to change issue owner New 2008-08-04

History

#1 Updated by Felix Schäfer about 10 years ago

See source:/trunk/app/controllers/issues_controller.rb#L307, the author of an issue will always be the user hitting the crontroller, be it over html or REST.

#2 Updated by Eric Davis about 10 years ago

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

Felix is right. There is a feature request (#1739) for setting author to another user but it's not Redmine yet. (e.g. UserA creates Issue for UserB with UserB as the "author"). Once it's added to Redmine, it will include API access.

I have some code a client is testing out that does this but it's not ready for release quite yet.

#3 Updated by Terence Mill about 10 years ago

+1

#4 Updated by Joerg Oswald over 8 years ago

+1

#5 Updated by Paul Wehle over 7 years ago

+1

#6 Updated by Jean-Philippe Lang over 7 years ago

Scott Doerrfeld wrote:

Is setting the author_id not allowable from the REST API or am I missing something?

Setting author_id is not allowed. But you can use User-Impersonation when using the API with an admin account.

#7 Updated by Paul Wehle over 7 years ago

Setting author_id is not allowed. But you can use Rest_api when using the API with an admin account.

Hi Jean-Philippe, sorry I don't understand the meaning of your comment. Could you elaborate please?

In my case I'd like to see who was the user who reported the issue, this is the author of the issue. Since author_id cannot be set through REST API I am not sure how to achieve this.
Even if using Rest_api with an admin account I believe the author_id cannot be set as shown in create_issue request Rest_Issues where this parameter does not exist.

#8 Updated by Jean-Philippe Lang over 7 years ago

User-Impersonation lets you make a API request as if it was done by another user. You should be able to use it to set the issue author to a different user. You just need to set the X-Redmine-Switch-User header of your API request to the login of the user that should be the author of the issue.

Also available in: Atom PDF