Groups to Templates via API

web_api
authentication

(Richard Bown) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

SonarQube 7.1 and 7.5

  • what are you trying to achieve

Automatic provisioning on teams via SonarQube API. In particular I want to retrieve a list of groups associated with a permission template via the API but the most likely end point:

api/permissions/search_templates

only returns a number of groups not the contents. How do I query the groups associated with a permission template from the API?

  • what have you tried so far to achieve this

Been through all the documentation I can find but most of it is outdated - the API endpoint itself is difficult to format to make it useful.


(Colin Mueller) #2

Richard,

You’re probably looking for GET api/permissions/template_groups, which is an Internal API (check the “Show Internal API” box when viewing Web API documentation).

Remember, you’ll have to iterate through each permission of a permission template to get all groups associated with them.

Curious to hear your use-case for this?

Colin


(Richard Bown) #3

Ah ha, great. Thanks for the speedy response, I’ll check that out. I thought I was going mad…

We’re building team onboarding for enterprise so this will tie up eventually to a single request for getting devops teams up and running/modifying access etc.


(Colin Mueller) #4

Word of advice: if you’re ever not sure what API is being used on the UI side, hitting up the “network” tab of something like chrome dev tools while performing the action is always really helpful. That is how I answered your question for myself :slight_smile: