# Difference api/issues/search vs api/measures/component

**URL:** <https://community.sonarsource.com/t/difference-api-issues-search-vs-api-measures-component/23680>\
**Category:** SonarQube Server / Community Build\
**Created:** [April 25, 2020, 6:09pm UTC](https://community.sonarsource.com/t/difference-api-issues-search-vs-api-measures-component/23680 "2020-04-25T18:09:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbee](https://avatars.discourse-cdn.com/v4/letter/n/5f8ce5/32.png) [@newbee](https://community.sonarsource.com/u/newbee)\
**Post date:** [April 25, 2020, 6:09pm UTC](https://community.sonarsource.com/t/difference-api-issues-search-vs-api-measures-component/23680/1 "2020-04-25T18:09:02Z")

</div>

Hey, I want the number of ALL CodeSmells for a project and used:

[http://localhost:9000/api/issues/search?ps=100&types=CODE\_SMELL&component={KEY}](http://localhost:9000/api/issues/search?ps=100&types=CODE_SMELL&component=%7BKEY%7D)

this here will give me a huge number.

[http://localhost:9000/api/measures/component?metricKeys=code\_smells&component={KEY}](http://localhost:9000/api/measures/component?metricKeys=code_smells&component=%7BKEY%7D)

This here will give me the same number as in the screenshot.

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

So which method is the right one if I want to know all CodeSmells in a project? How can there be such a difference? I am very confused.

---

<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:** [April 26, 2020, 12:09pm UTC](https://community.sonarsource.com/t/difference-api-issues-search-vs-api-measures-component/23680/2 "2020-04-26T12:09:54Z")

</div>

**GET api/issues/search** is returning all Code Smells ever raised on the project (whether they are now fixed, marked as false-positive, etc.) You can check the Web API documentation for how to further narrow this result set if needed.

**GET api/measures/component** is returning the existing number of open code smells.

---

<div class="post-metadata">

**Author:** ![newbee](https://avatars.discourse-cdn.com/v4/letter/n/5f8ce5/32.png) [@newbee](https://community.sonarsource.com/u/newbee)\
**Post date:** [April 26, 2020, 10:06pm UTC](https://community.sonarsource.com/t/difference-api-issues-search-vs-api-measures-component/23680/3 "2020-04-26T22:06:56Z")

</div>

[http://localhost:9000/api/measures/component?metricKeys=sqale\_index&component={KEY}](http://localhost:9000/api/measures/component?metricKeys=sqale_index&component=%7BKEY%7D)  
Is it right, that I would get the debts with this URL? Hence the the JSON file says sqale\_index gives the debts in days.

The problem is as you can see above there are only 2h debts but it gives me 130 as value in the JSON file.

Do you know why?

Or are the 2h only the CodeSmells debts?

---

<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:** [April 27, 2020, 8:35am UTC](https://community.sonarsource.com/t/difference-api-issues-search-vs-api-measures-component/23680/4 "2020-04-27T08:35:22Z")

</div>

The data is actually being returned in minutes (130 minutes = 2 hours)

This should be fixed in the **GET api/metrics/search** response as of SonarQube _v7.7_ ([SONAR-11802](https://jira.sonarsource.com/browse/SONAR-11802)) and will be fixed in the Metrics Definitions documentation soon ([SONAR-13137](https://jira.sonarsource.com/browse/SONAR-13137))
