REST API call to find code duplications

Using SONAR QUBE 7.6


I’m trying to get code duplication’s using web api. I have gone through web api documentation and still confused.

Please let me know the API URL for getting exact duplication for the project.

Apologize that I’m a new bee to sonar. please help


use GET api/metrics/search to list all available metric types, you’ll see a bunch
of duplicated metrics, e.g.

      "id": "360",
      "key": "new_duplicated_blocks",
      "type": "INT",
      "name": "Duplicated Blocks on New Code",
      "description": "Duplicated blocks on new code",
      "domain": "Duplications",
      "direction": -1,
      "qualitative": true,
      "hidden": false,
      "custom": false

Then use GET api/measures/component to get the measures for a specific metricKey
of some component.
The metricKey in the json snippet above is key => new_duplicated_blocks


1 Like

Awesome ! Worked like a charm.

This is exactly what i was looking for. Thanks a ton Gilbert.