# Discrepancy between Project Count from Sonar Web API and Database Query

**URL:** <https://community.sonarsource.com/t/discrepancy-between-project-count-from-sonar-web-api-and-database-query/111821>\
**Category:** SonarQube Server / Community Build\
**Tags:** sonarqube\
**Created:** [March 22, 2024, 3:42am UTC](https://community.sonarsource.com/t/discrepancy-between-project-count-from-sonar-web-api-and-database-query/111821 "2024-03-22T03:42:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jungle](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jungle/32/45874_2.png) [@Jungle](https://community.sonarsource.com/u/Jungle)\
**Post date:** [March 22, 2024, 3:42am UTC](https://community.sonarsource.com/t/discrepancy-between-project-count-from-sonar-web-api-and-database-query/111821/1 "2024-03-22T03:42:06Z")

</div>

sonarqube version：9.9.2.77730

The number of projects obtained through the web API is 1341, while the count obtained by querying the database table is 910. Why is there a discrepancy?

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/6/a/6a7b6bc93385eb457c8418f32ecb9216ba151786.png)  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/f/ef64f0c8fa7cb61498735a037f26f1e7ff23cca6.png)

---

<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:** [March 25, 2024, 9:46am UTC](https://community.sonarsource.com/t/discrepancy-between-project-count-from-sonar-web-api-and-database-query/111821/2 "2024-03-25T09:46:30Z")

</div>

Hey there.

**GET api/projects/search** when used without `?qualifiers=TRK` returns projects, applications, and portfolios, not only projects (don’t ask why).

Do you have applications/portfolios on your instance?

---

<div class="post-metadata">

**Author:** ![Jungle](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jungle/32/45874_2.png) [@Jungle](https://community.sonarsource.com/u/Jungle)\
**Post date:** [March 28, 2024, 9:14am UTC](https://community.sonarsource.com/t/discrepancy-between-project-count-from-sonar-web-api-and-database-query/111821/3 "2024-03-28T09:14:35Z")

</div>

Thank you for your response.

After appending “?qualifiers=TRK” to the API call, I noticed that it returned 1342 results. However, I must clarify that I do not have any applications or portfolios on my instance. It seems there might be a discrepancy in the returned data or a misunderstanding of the query parameters. Could you please provide further clarification or guidance on how to accurately retrieve only projects?

Thank you for your assistance

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/0/a/0a3dc8c68a62205bb566807d5bdaf5366f48deca.png)  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/9/c/9c81877ad698c39888041fd7fa4e2223d200324a.png)  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/3/e3d3a929c52774f6e0af63cb71dd5616c9cc6da6.png)

---

<div class="post-metadata">

**Author:** ![Jungle](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jungle/32/45874_2.png) [@Jungle](https://community.sonarsource.com/u/Jungle)\
**Post date:** [March 28, 2024, 9:55am UTC](https://community.sonarsource.com/t/discrepancy-between-project-count-from-sonar-web-api-and-database-query/111821/4 "2024-03-28T09:55:22Z")

</div>

I recently created a new project, and while I can query it successfully both through the web interface and the web API, I noticed that the data does not appear in the ‘projects’ table in the database. Despite this, the project is functioning as expected within the system.

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/2/7/27ec0b24361787370005c1ae55dc57836c0c83f3.png)

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/2/9/29015360025ba922f0b44ef09761c4d2f15e247e.png)

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/3/c/3c980719afedc3f14e7ae7951ebfc7cb68fcdf66.png)
