Getting CodeSmells from the last 2 weeks

Hey,
I am using the latest SonarQube version.

I want to retrieve all raised CodeSmells from the last 2 Weeks via the WebApi.
For CodeSmells I always use:
http://localhost:9000/api/measures/component?metricKeys=code_smells&component={KEY}.
But I can not use the createdInLast parameter here.

createdInLast is a parameter for /api/issues/search?

http://localhost:9000/api/issues/search?types=CODE_SMELL&component={KEY}

But issues!=measures/component right?

I only want to see how many CodeSmells have been RAISED in the last 2 weeks.
And if possible I want to see how many have been solved in the last 2 weeks.

Is that possible?

Hi,

The easiest thing to do here is use the UI to get issue set you want and use your browser’s developer tools to eavesdrop on the calls that pull that data. Regarding counts versus individual issues, I would still use the issues web service here, but limit page size to 1 (&ps=1). The pagination block that’s included in these responses will give you the full count.

Regarding the number closed in the last 2 weeks, sorry but that’s just not something we’ve built for. You’re not going to be able to pull this data from SonarQube.

 
HTH,
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.