I was trying to use the api/alm_settings/set_bitbucket_binding endpoint of the Sonar Web API(Docker Image https://hub.docker.com/layers/library/sonarqube/25.1.0.102122-community) to automate setting the DevOps Platform Integration within an individual Project settings, which wasted 30 mins of my time.
The UI page which does the same:
Looking past the obvious violation of REST API convention of using Query Parameters instead of the Request Body to pass on values in the POST request, it appears that the use of the parameters themselves is flawed.
The endpoint expects the following request parameters:
- almSetting
- monorepo
- project
- repository
- slug
Problems with the API documentation:
-
It is unclear what project means, given that the UI expects a projectKey parameter, which is the project name from Bitbucket, whereas the API expects this to be the sonar.projectKey property.
-
There is a clear lack of clarity and a potential logical fallacy here, where slug means the name of the repo in the Bitbucket URL, and repository means the name of the project in the Bitbucket URL. Took me some time to get the combination right.
I would request that the documentation of this Sonar Web API endpoint and the usage of the query parameters be made a little clearer, as the current one is not intuitive at all.