jsonsonarqubesonarqube-api

How to select javascript issues and their comments?


I am using the SonarQube 6.4 API in order to search for issues. I do have two questions regarding it:

  1. Can I filter on issues related to a language?

I tried http://localhost:9000/api/issues/search?vulnerabilities=BLOCKER&language=JAVASCRIPT and I've got results for other languages in the json too.

  1. If a tester adds a comment for a specific issue, can I have it in the json results? If so, how?

enter image description here


Solution

    1. According to the docs for the issue search web service, here are the parameters you need to make your query work right:
      • types=VUNLERABILITY
      • severities=BLOCKER
      • languages=js

    To be fair, it doesn't explicitly say that 'js' is the language key for JavaScript, but it does show it in the example. The easiest way to know what the key is for a language is do to a search for its issues via the interface and then look at the resulting URL

    1. To add comments to the response, you'll also need
      • additionalFields=comments