Problems updating "status_id" on an issue using the API.
Added by Paul Philion 22 days ago
I have code that can reliably create an issue, and then update it to set assigned-to and status. The problem is, it is only works using an Admin user. I cannot find which setting allows a user to assign a ticket to themselves and set the status to "in progress". Setting the status is the issue, but I can't figure out what permission to give general users to make it work.
First, POST this to /issues.json:
{ "issue": { "project_id": 1, "subject": "TEST", "description": "This is a test.", } }
Then update issue X with PUT to /issues/X.json
{ "issue": { "assigned_to_id": "me", "status_id": "2" } }
This works as expected when the API token is associated with an ADMIN user and the X-Redmine-Switch-User is unset or set to another ADMIN user.
It quietly fails if I use the same API token with a X-Redmine-Switch-User who's just a User. Note: "assigned_to" is correct after the PUT, but the status of the issue is unchanged.
Currently, I've given the User role all permissions under Issue Tracking and Trackers, and made certain the test-user has a User role on on the project.
Thanks!
Replies (2)
RE: Problems updating "status_id" on an issue using the API. - Added by Holger Just 22 days ago
- To be able to assign issues to a user, the designated assignee must have a role in the project which has the "Assign issues to this role" flag enabled.
- The editing user must have the "Edit issues" permission via a role. Note that you can further restrict the view/edit/delete issues permissions per tracker on the bottom of the role edit screen. Check that the editing user has the required permissions
- To be able to set a status, the editing user must be allowed to change the issue in its current tracker and status to the new status. This is defined in Administration -> Workflows.
In any case, the API follows the same permissions which are applied in the Web UI. To check what is happening, you can login with your non-admin user and try to create / update the issues from your browser. Sometimes, this makes things more clear.
Finally some notes regarding the API use:
- If there are any validation errors (e.g. invalid fields, ...) these are generally sent in the API responsee. Check the status code and response body of your edit request.
- You can direct set the
assigned_to
andstatus_id
fields when creating the issue. It should not be required to update the issue again after you have just created it.
RE: Problems updating "status_id" on an issue using the API. - Added by Paul Philion 21 days ago
Holger,
The Administration -> Workflows did it, after I enabled a New -> In Progress transition for "User".
Thanks for your help!