Hi,
Thank for your answer.
I changed my api call and it works now.
I have another question, how can I read the answer to the API call ?
do I have to write a parser JSON ?
Thank
Fred
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)
}