API to get projects based on a permission template (or) capture newly created project

Is there an API available to have the permission template name / id as an input argument and show the list of projects which are leveraging that specific permission template?

I am trying to capture a triggering point to identify any new projects that get created at SonarQube during the pipeline. If I know which project is created, I can then trigger next step of API calls to map the project with appropriate group and permission template whereas by default all projects will be having the default permission template during the creation.

Hey there.

A permission template is only applied at creation – no lasting link exists between the project and the permission template.

If you’re already extracting the API calls to set permissions with an automation, you might consider doing the same with project creation (making sure the project is created with a certain, known project key pattern can also mean the right permission template can automatically be applied).

Thank you for the response, Colin. I am looking for an approach to create and set permission template, if it is going to be a new project at SonarQube. Looking for how to differentiate that. By default, for any projects that are created a fresh, the default permission template will be applied. I want to apply the project specific permission template.
Since we cannot leverage project key pattern for setting the permission template, is there an option available to explore on this?

Hey there.

This is something you’d have to automate yourself using APIs (checking for new projects, and what permissions are applied).

Can you talk about why you can’t leverage project key patterns?

Hi Colin,

We have around 14K+ projects and many of them having similar project key pattern such as abc:abc-00:project_name (abc is mentioned as a sample it will be replaced by any 3 alpha-numeric characters, an unique identifier for applications), which I have explained in my other question How to map a group to a project key to restrict user's access to project/portfolio?

I learnt that it is not possible to map a project key pattern with the group or project or permission template. If there is any, please share a sample for me to investigate further.

Appreciate your help!