I am using Sonarqube Web, version API-9.1.0.47736. With Web API I am able to authenticate, create and delete projects. I have a problem when I try to get the results of the completed evaluation of my projects. For this, I use GET api/measures/component HTTP request with project key as ‘component’ parameter and the keys of the elements I want to retrieve as the ‘metricKeys’ parameter.
The response I get is the following:
{"errors":[{"msg":"The \u0027component\u0027 parameter is missing"}]}
The driver code:
auth_response = session.get(url + 'api/metrics/search')
obj = {'component': 'humaneval_0', 'metricKeys': 'code_smells, bugs, new_vulnerabilities'}
measures_response = session.get(url + 'api/measures/component', data=obj)
print(measures_response.text)
‘Authenticate’ Subroutine:
def authenticate(url, myToken):
session = requests.Session()
#authenticate session with token
session.auth = (myToken, '')
auth = session.post(url + 'api/user_tokens/search')
response = session.get(url + 'api')
return session
Any help would be much appreciated.
Thanks.