tree: Navigate through components based on the chosen strategy

API: sonarcloud.io:sonarqube
Endpoint: /api/components/tree
Response format: application/json
Auth: unknown
Method: GET
Last Status: 400
Latency: 181ms

Description

Navigate through components based on the chosen strategy. Requires the following permission: 'Browse' on the specified project. When limiting search with the q parameter, directories are not returned.

Parameters (10)

asc (string, query, optional, default: true)

Ascending sort

Constraints: {'enum': ['true', 'false', 'yes', 'no']}

branch (string, query, optional)

Branch key

component (string, query, required)

Base component key. The search is based on this component.

p (string, query, optional, default: 1)

1-based page number

ps (string, query, optional, default: 100)

Page size. Must be greater than 0 and less or equal than 500

pullRequest (string, query, optional)

Pull request id

q (string, query, optional)

Limit search to: - component names that contain the supplied string- component keys that are exactly the same as the supplied string

qualifiers (string, query, optional)

Comma-separated list of component qualifiers. Filter the results with the specified qualifiers. Possible values are: - BRC - Sub-projects- DIR - Directories- FIL - Files- TRK - Projects- UTS - Test Files

Constraints: {'enum': ['BRC', 'DIR', 'FIL', 'TRK', 'UTS']}

s (string, query, optional, default: name)

Comma-separated list of sort fields

Constraints: {'enum': ['name', 'path', 'qualifier']}

strategy (string, query, optional, default: all)

Strategy to search for base component descendants: - children: return the children components of the base component. Grandchildren components are not returned- all: return all the descendants components of the base component. Grandchildren are returned.- leaves: return all the descendant components (files, in general) which don't have other children. They are the leaves of the component tree.

Constraints: {'enum': ['all', 'children', 'leaves']}

Examples (1)

Navigate through components based on the chosen strategy openapi-spec
curl 'https://sonarcloud.io/api/components/tree?branch=feature%2Fmy_branch&component=my_project&p=42&ps=20&pullRequest=5461&q=FILE_NAM&s=name%2C+path'
import requests

resp = requests.get(
    "https://sonarcloud.io/api/components/tree",
    params={
        'branch': 'feature/my_branch',
        'component': 'my_project',
        'p': '42',
        'ps': '20',
        'pullRequest': '5461',
        'q': 'FILE_NAM',
        's': 'name, path',
    },
)
data = resp.json()
import zingu_apis

api = zingu_apis.api("sonarqube")
result = api.fetch("api/components/tree", branch="feature/my_branch", component="my_project", p=42, ps=20, pullRequest=5461, q="FILE_NAM", s="name, path")

for item in result:
    print(item)
const resp = await fetch("https://sonarcloud.io/api/components/tree?branch=feature%2Fmy_branch&component=my_project&p=42&ps=20&pullRequest=5461&q=FILE_NAM&s=name%2C+path");
const data = await resp.json();

Probe History

Latency

Status Codes

TimeStatusLatencySize
2026-04-16 03:00:03.394288 400 181ms
2026-04-15 02:55:17.303260 400 145ms
2026-04-14 00:34:22.421556 400 182ms
2026-04-12 16:00:43.322384 400 243ms
2026-04-10 01:36:30.488889 400 1745ms
2026-04-09 00:28:23.228391 400 221ms