Quality Profile of Project

Hello…
thanks un advance, could someone please help me to get the specific Quality Profiles of a Project… i use the web api but doesn´t seems to be the right answer.

…/api/qualityprofiles/search?qualityProfile?&projectKey=NAME_OF_PROJ

thanks again…

Hi,

There’s not a targeted way to get this. It’s going to be messy:

You’ll need to start by looking at the default profile for each language (api/qualityprofiles/search?defaults=true). That gets you a profile per language. Then look at all the other profiles, and for each one, pull the list of projects explicitly associated to it (api/qualityprofiles/projects) to see if the default profile is overridden for that language.

 
HTH,
Ann

Thanks Ann …
I’ve also had this idea … I tell you: download the assigned profiles with: api/qualityprofiles/search?&project=NAME_PROJECT … which gives me all the profiles assigned to the project even by default, and not used in analysis.
Next step: when downloading the issues take the language of the issue and cross them with the language of the profiles, which would give me the profile applied in the analysis.

That reminds me of this question:
This gives me one language: …api/qualityprofiles/search?&language=c%2b%2b&project=NAME_PROJECT
This gives all: …api/qualityprofiles/search?&project=NAME_PROJECT
Is there any way to get two or n languages ​​in this api-get?

Thanks again…

Hi,

Nice! I missed that.

You run the tiny risk of missing a profile when there are no issues for a language. :smile:

Sorry, I don’t understand the question.

 
Ann

Hi Ann…
i don´t care about the risk of missing a profile if there are no issues … because, i only want just the profiles in use… in other words the profiles of the issues…

About the last question…
…api/qualityprofiles/search?&language=c%2b%2b&project=NAME_PROJECT
this return only the profile used in this project (NAME_PROJECT) for this language c++ (c%2b%2b)

and…
…api/qualityprofiles/search?&project=NAME_PROJECT
this return all the profiles for this nproject…all languages…

my question is: there is a way to get 2 or maybe 3 profiles… for ona project… something like this:
…api/qualityprofiles/search?&language=c%2b%2b&language=cs&project=NAME_PROJECT
for c++ and c#

for being there and take the time to help …

thanks,

Hi,

It looks like the language parameter is singular. Sorry, but this is just not a use case we’ve ever put any effort toward.

 
Ann

I think what leoncio is asking, and what I am looking for as well, is a way to get the currently used languages for a given project, so that only the relevant QPs are returned. Is this really not possible in the API?

Hi,

Welcome to the community!

As I said earlier, this is simply not a use case we’ve put any effort into. The APIs were built to support drawing the interface. If it’s not needed for that, we probably didn’t build it.

That said, there is a list in the project homepage (Project Information slide-out) of the profiles used in the most recent analysis. I suggest using your browser tools to eavesdrop on that call.

 
Ann

Yes, I was looking there, I couldn’t find what I was looking for though, there didn’t seem to be any API calls getting that data, I thought that maybe that data was loaded during page load.

However, the Manage Quality Profiles page on a project does seem to do a relevant call, going to:

https://myhost/api/navigation/component?component=myproject

That gives me the two quality profiles and thus their languages as well. It seems this is an internal API call, I suppose there are some risks in using it?

Hi,

If it’s marked internal it could theoretically change without notice. So yes, there’s some risk.

In practice, we haven’t worked on that part of the UI in quite some time & from what I understand of the plans, it will be quite some time before we feel the need to do so.

 
HTH,
Ann