Project

General

Profile

Actions

Defect #6373

closed

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

Added by Scott Doerrfeld over 13 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
2010-09-12
Due date:
% Done:

0%

Estimated time:
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 authorReopenedGo MAEDA2008-08-04

Actions
Actions #1

Updated by Felix Schäfer over 13 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.

Actions #2

Updated by Eric Davis over 13 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.

Actions #3

Updated by Terence Mill over 13 years ago

+1

Actions #4

Updated by Joerg Oswald almost 12 years ago

+1

Actions #5

Updated by Paul Wehle about 11 years ago

+1

Actions #6

Updated by Jean-Philippe Lang about 11 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.

Actions #7

Updated by Paul Wehle about 11 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.

Actions #8

Updated by Jean-Philippe Lang about 11 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.

Actions

Also available in: Atom PDF