Complexity average by file not retrieved from API

[SonarQube Dev ed. 9.9.1 + JaCoCo maven plugin 0.8.10]
I’ve seen that there are similar topics but none that precisely answer this question. sorry if this is a duplicate.

I’m interested in getting the complexity per function via API.

using the call api/metrics/search, I see multiple complexity metrics are available:

            "id": "AYMRfLpN4WbZqIpRSTlg",
            "key": "function_complexity",
            "type": "FLOAT",
            "name": "Complexity / Function",
            "description": "Complexity average by function",
            "domain": "Complexity",
            "direction": -1,
            "qualitative": true,
            "hidden": true,
            "decimalScale": 1
            "id": "AYMRfLpM4WbZqIpRSTlf",
            "key": "complexity_in_functions",
            "type": "INT",
            "name": "Complexity in Functions",
            "description": "Cyclomatic complexity in functions",
            "domain": "Complexity",
            "direction": -1,
            "qualitative": false,
            "hidden": true

but when I request these and other metrics via API, for the others I get values (for ex. complexity average by file), for these I get nothing.
However, the jacoco report contains this information, because it shows the complexity for each single function.
how do I export them from sonarqube?

Thank you in advance.


Those extra complexity metrics you’ve found are vestigial. We used to calculate (and store) things like LCOM4, depth in tree, response for class, and complexity per method. We don’t anymore. But the metrics linger in the list in instances that have been around for a while.