Im using the SonarQube Web API to extract analysis information and generate a docbook report from it.
However I am not sure about the meaning of some of the data.
When using the web api function “api/measures/component” I get a response like this:
The problem is I dont know what the index field refers to. Some entries dont even have an index and contain only a single value. Unfortunately the official documentation doesnt offer any Information about that.
I’m guessing you are using a quite old version of SonarQube.
It used to be possible to have values for multiple configured periods. The index refers to the details about the period in “periods”.
The Webservices of any newer SonarQube (including all versions since the current LTS v6.7) should only return one period, which is the leak period.
The data structure is the same and the index will always be 1. The value corresponds to what is measures within the configured leak period (usually since the version of the project changed).
To add on to @dmeneses’s excellent response, some clarity can be shed on what the “periods” are by adding the query parameter/value additionalFields=periods to your Web API request, like so: