Api/project_tags/set overwrites existing tags

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube Enterprise 9.3

  • what are you trying to achieve
    Adding/Updating tags using api/project_tags/set API for projects

  • what have you tried so far to achieve this
    The set api set the tags to projects, but also overrides existing tags.
    If there is tag that is already present eg. “java” and when i try to add “microservice” tag to the project using set API, it only show microservice tag. The java tag is overridden.

I am missing something or this by default functionality of “api/project_tags/set” API.
Is there any way that i can to add tag but the existing one doesn’t get effected.

Hi,

Have you tried this via the UI? The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.

You may also find this guide helpful.

 
HTH,
Ann

Yes, I have tried from UI. With UI we can simply add new tags without effecting the existing one.

I followed the guide and it seems the API call is same, but it seems the call send POST request with both the tags.

Also running into the same issue. Whenever I run the same post request through the API it removes any current tags and replaces all tags with the list of tags I just input.

@ganncamp , I think i can try a code fix , let me know if i can raise Pull Request to fix the issue.
I don’t see any issue or bug in the sonarqube project related to this issue.

Hi @raghureddycloud,

Thanks for your willingness to pitch in!

Unfortunately, since we don’t see this as a bug, and since there’s no ticket for this, your PR is unlikely to be merged.

 
Ann