# Web API: api/qualitygates/search - projects using default Quality Gate

**URL:** <https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368>\
**Category:** SonarQube Server / Community Build\
**Tags:** web\_api\
**Created:** [May 18, 2021, 7:08am UTC](https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368 "2021-05-18T07:08:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![guwirth](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/guwirth/32/124_2.png) [@guwirth](https://community.sonarsource.com/u/guwirth)\
**Post date:** [May 18, 2021, 7:08am UTC](https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368/1 "2021-05-18T07:08:05Z")

</div>

Hello,

I want to use the web API to get a list of projects that use the default Quality Gate (SQ 7.9). Using `api/qualitygates/search` with the `gateId` of the default Quality Gate does not work, selected returns false. Seems that this API only returns explicitly assigned Quality Gates?

**How can I get a list of projects that use the default Quality Gate?**

Regards,  
Günter

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [May 18, 2021, 9:35am UTC](https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368/2 "2021-05-18T09:35:32Z")

</div>

Hey Günter,

You will have to iterate through each project using **GET api/qualitygates/get\_by\_project** and parse the results from there.

For example:

```
http://localhost:9000/api/qualitygates/get_by_project?project=org.sonarqube%3Asonarqube-scanner

{"qualityGate":{"id":"AXk2kfnOX2R_NZrDp2_d","name":"Sonar way","default":true}}
```

---

<div class="post-metadata">

**Author:** ![guwirth](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/guwirth/32/124_2.png) [@guwirth](https://community.sonarsource.com/u/guwirth)\
**Post date:** [May 18, 2021, 7:08pm UTC](https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368/3 "2021-05-18T19:08:36Z")

</div>

Hi Colin,

Thanks a lot for your solution.

The thing I don’t understand is why I don’t get this result from the **api/qualitygates/search** API? If no explicit Quality Gate is set, it is per definition the default. Think the current behavior is a bug.

Regards,  
Günter

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [May 18, 2021, 8:33pm UTC](https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368/4 "2021-05-18T20:33:53Z")

</div>

Hey Gunter,

Projects using the default Quality Gate are not really assigned any Quality Gate explicitly…. for those projects SonarQube just looks up what the default is and use that.

Nowhere in the UI lists out the projects using the default quality gate, and therefore the web services aren’t designed to do so either.

---

<div class="post-metadata">

**Author:** ![guwirth](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/guwirth/32/124_2.png) [@guwirth](https://community.sonarsource.com/u/guwirth)\
**Post date:** [May 20, 2021, 2:35pm UTC](https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368/5 "2021-05-20T14:35:23Z")

</div>

Hi Colin,

> … Nowhere in the UI lists out the projects using the default quality gate …

Yes you are right, that is the second problem. Also in the UI there is no possibility to find out which projects are using the Default Quality Gate (by the way with Default Quality Profiles it’s the same issue).

In both cases it is not very logical that I’m not able to see it. If no explicit value is assigned it’s the default. So if I’m asking “who is using this quality gate/profile?” I should get all which are using it (direct or indirect).

Regards,

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [May 20, 2021, 4:52pm UTC](https://community.sonarsource.com/t/web-api-api-qualitygates-search-projects-using-default-quality-gate/43368/6 "2021-05-20T16:52:36Z")

</div>

Hey Günter,

> [@guwirth](#):
>
> So if I’m asking “who is using this quality gate/profile?” I should get all which are using it (direct or indirect).

In no way do I think this is an invalid question, **and** I think it helps your case if you discuss the use-cases for this information that are relevant to you.
