I have recently migrated python code working with the Sonarqube API from one server to another.
However, on the new server, I now receive the following error message with a GET request:
{"errors":[{"msg":"The \u0027component\u0027 parameter is missing"}]}
Migrating the script was relatively simple. I simply targeted the new sonarqube server URL and provided a new token. The script does appear to be working correctly except for the newly introduced error as one of the requests in the script seems to be working correctly.
I receive the error on command line after running the python.
Here’s an example of the code from the python script:
for key in json_blob['components']:
component_url_param = '&'+urllib.parse.urlencode({'componentKey':key['project']})
req = requests.get(measures_url+metrics_url_param+component_url_param, proxies=proxies, auth=(userinfo["user_token"], ''))
json_measures = req.json()
print(req.text)
The output from req.text is {"errors":[{"msg":"The \u0027component\u0027 parameter is missing"}]}
It seems like you can just swap this out for component. This is probably the result of upgrading to a version of SonarQube that dropped long deprecated APIs (SONAR-13848)