Liste of issue for a rule with WEB API

Hi,
it’s json parsing as usual.
First you’ll have to get the json by web api call, then you’ll need to parse it.
My generic Groovy snippet for Sonarqube web api calls is like that:

import groovy.json.*

def sonarRest(url,method,usertoken) {
  jsonSlurper = new JsonSlurper()
  raw = usertoken + ':'
  bauth = 'Basic ' + javax.xml.bind.DatatypeConverter.printBase64Binary(raw.getBytes())
  conn = new URL(url).openConnection() as HttpURLConnection
  conn.setRequestMethod(method)
  conn.setRequestProperty("Authorization", bauth)
  conn.connect()
  httpstatus = conn.responseCode
  object = jsonSlurper.parse(conn.content)
}

I took Groovy because it’s my weapon of choice and best for Jenkins pipelines + scripting.
For Jenkins wrap it up in a shared library but !! use JsonSlurperClassic() with @NonCPS annotation
see
http://groovy-lang.org/json.html
https://docs.groovy-lang.org/latest/html/gapi/groovy/json/JsonSlurper.html

Gilbert