Component parameter is missing?

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"}]}

How can I resolve this error?

Hey there.

  • What steps did to take to do the migration?
  • Where do you receive the error (the browser? a script? another application?)
  • 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)

Switching componentKey for component seems to have done the trick. Thank you very much.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.