List of all public projects on sonarcloud using api

There is a way to list all public projects on sonarcloud using api ?

I have look for all api services but I just found services like these:

GET api/components/search or GET api/projects/search
where we need to pass the organization parameter.

https://sonarcloud.io/api/components/search?organization=my-organization&qualifiers=TRK

That is Ok when I want components for specific organization. But I want the service that I could recovery all public projects or organization to start analyze then. I don’t want information of specific organization or project. Some thing like this:

https://sonarcloud.io/api/components/search?qualifiers=TRK

How this is possible? I know that is possible, because I read many papers where the authors said:

“We query SonarCloud using the available web APIs [27] and extract the list of all the open source projects that use the free analysis service”

How I can do that using sonar API?

I thank you in advance

Hi Jadson,

you can use the API we use in the explore section of the service.

This API is called when you browse the public projects back and forth.

It goes like this in this page:
https://sonarcloud.io/api/components/search_projects?boostNewProjects=false&facets=ncloc%2Clanguages&p=2&ps=50&f=analysisDate&s=analysisDate&asc=false

By using the browser inpsector (whatever the browser) you can understand what are the various parameters for.

If you build a script which extracts those data please consider to use human like delays (something between 5 and X secs will mimic a human reading the page) between invocations if you don’t want to be blocked at some point.

Thanks.

Best.

1 Like

Hi Olivier Schmitt,

I understood. Thank you, this is helpful.

I just did not understand why this service https://sonarcloud.io/api/components/search_projects is not available in sonarcloud API docs page: https://sonarcloud.io/web_api/.

Best.

Hi,

The main use case of SonarCloud is to offer features to help development teams to write better code.
So users are interesting in their organization and the projects they are working on.

Your use case does not make sense in regards to this goal.

But from a service perspective, we need to have this API in the explore section and this API is designed for the front end of SonarCloud, not for users.

Best.

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