Return component with specified measures. The componentId or the component parameter must be provided. Requires the following permission: 'Browse' on the project of specified component.
Parameters (8)
additionalFields(string, query, optional)
Comma-separated list of additional fields that can be returned in the response.
Constraints: {'enum': ['metrics', 'periods']}
branch(string, query, optional)
Branch key
component(string, query, optional)
Component key
componentId(string, query, optional)
Component id
developerId(string, query, optional)
Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set.
developerKey(string, query, optional)
Deprecated parameter, used previously with the Developer Cockpit plugin. No measures are returned if parameter is set.
metricKeys(string, query, required)
Comma-separated list of metric keys
pullRequest(string, query, optional)
Pull request id
Examples (1)
Return component with specified measuresopenapi-spec
import zingu_apis
api = zingu_apis.api("sonarqube")
result = api.fetch("api/measures/component", additionalFields="periods,metrics", branch="feature/my_branch", component="my_project", componentId="AU-Tpxb--iU5OvuD2FLy", metricKeys="ncloc,complexity,violations", pullRequest=5461)
for item in result:
print(item)
const resp = await fetch("https://sonarcloud.io/api/measures/component?additionalFields=periods%2Cmetrics&branch=feature%2Fmy_branch&component=my_project&componentId=AU-Tpxb--iU5OvuD2FLy&metricKeys=ncloc%2Ccomplexity%2Cviolations&pullRequest=5461");
const data = await resp.json();