API REST "Insufficient privileges" on the /applications/* endpoint

SonarQube version: Enterprise Edition * Version 8.9.10 (build 61524)

What I am trying to achieve
I’m using the REST API to interact with the /applications/ endpoint to check if an application already exists (I use the show_application endpoint) and I receive in return:

{"errors":[{"msg":"Insufficient privileges"}]}

I am using the a python library python-sonarqube-api and at first I thought it was due to the library itself, but then I realized it happens with a simple CURL:

curl -X GET -u $SONAR_TOKEN: https://sonarqube.mycompany.com/api/applications/show?application=testapp

Weird thing is that it has worked a very few times, not sure why, it’s just like randomly it works but most of the time it returns the privileges message.

Maybe it’s really a permission issue but if it is I don’t really know what should I set, since I have an admin role.

By the way, the “delete” and “update” endpoints for “/applications/” also return the privileges message. The “create” endpoint, in the other hand, works perfectly.

Finally I found the issue. The “application” had an incorrect permission template, the assigned groups were lacking the “browse” permission for the application that was being created.

In the enterprise version the “applications” can be found under Administration → Projects → Management → select “Applications” under the dropwdown menu. From there you can set the correct template or delete the application and recreate it with the proper permissions template.

I hope this helps someone someday.

1 Like

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