Why doesn't the sonarcloud.io component search API return a component that exists?

I’m trying to use the components search API to find projects and/or subprojects.

This URL gives no results: https://sonarcloud.io/api/components/search?qualifiers=BRC,TRK&q=nl.ictu:hq

{
"paging": {
"pageIndex": 1,
"pageSize": 100,
"total": 0
},
"components": []
}

But the component is there because this works:

https://sonarcloud.io/api/components/show?qualifiers=BRC,TRK&component=nl.ictu:hq

{
"component": {
"organization": "ictu",
"id": "AV1Ve5PAO4GGCLhjfBeu",
"key": "nl.ictu:hq",
"name": "HQ",
"qualifier": "TRK",
"analysisDate": "2018-06-13T15:49:15+0200",
"tags": [],
"visibility": "public",
"leakPeriodDate": "2018-05-17T09:43:59+0200",
"version": "2.60.5"
},
"ancestors": []
}

What am I missing? Thanks in advance!

Hi Frank,

Looks like the trick is in passing the organization to search in: https://sonarcloud.io/api/components/search?qualifiers=BRC,TRK&q=nl.ictu:hq&organization=ictu . Works !

FYI organization is currently an internal parameter for now (hit ‘Show Internal API’ in the WebAPI documentation), so just be aware that it could evolve over time (no such plan for now, but better be transparent on this).

1 Like

Excellent, thank you!

2 posts were split to a new topic: How to find all components of an organization on SonarCloud