How to bulk change issues of one/multiple users to un-assigned using web_api

web_api
sonarqube

(karthik Reddy) #1

When I try to POST: “http://localhost:9000/api/issues/bulk_change/?iun-assign=kchella
Error: {“errors”:[{“msg”:“At least one action must be provided”}]}

How do I use api to change the user assigned issues(4.5K) to un-assigned?

SonarQube version: 6.7.3LTS


(Grégoire Aubert) #2

Hello,
This is normal, the iun-assign parameter doesn’t exist, you can find all valid parameters in the API documentation : https://next.sonarqube.com/sonarqube/web_api/api/issues/bulk_change

To be more precise, what you are looking for are the assign and issues parameters. To un-assign issues you just have to pass an empty value to the assign parameter. And you must provide a list of issues to be affected by the bulk action.
If I take your exemple it would be something like: POST http://localhost:9000/api/issues/bulk_change/?assign=&issues=issuekey1,issuekey2,issuekey3


(karthik Reddy) #3

Gregoire_Aubert,

I’m looking to un-assign all issues for a specific user, it will hard to get the issuekey for 10K issues and un-assign them.


(Grégoire Aubert) #4

For sure it’s not possible to do it manually, but there is currently no all in one web-service to do this easily.

So you will probably have to rely on a script and on api/issues/search as well to retrieve all issues of that specific user. Then you can feed those issues to api/issues/bulk_change with the empty assign parameter to un-assign them all.

And you will probably have to call both those web-services multiple time because the one to search issues is paginated to a maximum of 500 issues per requests and I think the one to do bulk change accept a maximum of 250 issues per call.