How to filter on project key using api/components/search_projects?

Dear all,

First of all, let’s precise I am a SonarCloud user.

The objective is to retrieve the associated tags to a given project. In order to achieve this I am using the internal api api/components/search_projects. Please find my http request

/api/components/search_projects?organization=myorg&filter=%27query=%22projectKey%22%27

I have also tried /api/components/search_projects?organization=myorg&filter=%27query%3D%22projectKey%22%27

No success.

Searching based on the organization only does return the expected projects.

If there is another less risky way to retrieve the associated tags, I’ll take it. api/project_tags/search does not allow to provide with a list of projects.

Thank you for your support.

Best regards

Hi,

Welcome to the community!

Have you tried this via the UI? The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.

You may also find this guide helpful.

 
HTH,
Ann

No I haven’t. Thank you so much G Ann Campbell!

Based on the brilliant tip, I’ve found found that api/components/show?component=$PROJECT_KEY is returning what I needed, namely the tags.

Great :slight_smile:

1 Like