What is the "alm_integration/provision_projects" REST call for bitbucket cloud?

I don’t want to manually go into the bitbucket UI for ALL my repos every time I need to add a new sonar project and click a button to hook them up to their sonar project.

This is not officially supported, but thats a pain point everyone is using this workaround for:

I see no examples of how to do this for bitbucket only github. When I try making a POST to “https://sonarcloud.io/api/alm_integration/provision_projects” with my bitbucket info I get a 404.

This is the request for github:

curl --include \
    --request POST \
    --header "Content-Type: application/x-www-form-urlencoded" \
    -u ${SONAR_TOKEN}: \
    --data-binary "installationKeys=${GITHUB_ORG}%2F${REPO_NAME}%7C${REPO_ID}&organization=${SONAR_ORG}" \
   "https://sonarcloud.io/api/alm_integration/provision_projects"

What is the right request for bitbucket cloud?

I tried this but it returns a 404:
"installationKeys=${bitbucketOrg}_${repoName}&organization=${bitbucketOrg}"

Hey @red_888

Is it correct to assume that you have to do this because your projects are automatically created from your pipeline, and you only then perform the binding afterward?

I’m not comfortable giving guidance on internal APIs in the Community – and, a trip to your browser’s dev tools should make it clear what API calls are performed when you take a certain action from the Bitbucket side.

Yes I use the API to create the project if it does not exist. The missing piece is this binding config.

You should be able to see the values to supply to the API call if you follow through a manual example with Chrome Development tools. I detailed how to do that here:

https://www.jonathanmedd.net/2021/12/automating-sonarcloud-with-powershell-part-2-onboarding-a-project.html

Hope this helps