SonarCloud API - Issues and analysis data

Hi
I want to be able to query all issues and get the commit that close them.
I found the activity_feed API (internal one):

https://sonarcloud.io/api/activity_feed/list?initialPayload=true&project=<project-name>&ps=<page-size>

that returns the analysis’s data that contains this commit id that solved issues with the following structure:

{
      "type": "analysis",
      "createdAt": "2024-05-09T12:56:11.819Z",
      "data": {
        "analysisId": "AY9dbVP9IjjHdeuUh0d0",
        "firstAnalysis": false,
        "measures": {
          "violations_added": "0",
          "violations_fixed": "0",
          "coverage_change": "0.0",
          "duplicated_lines_density_change": "0.0",
          "ncloc_change": "0"
        },
        "pullRequest": {
          "analysisDate": "2024-05-09T12:56:11.819Z",
          "branch": "new_pr",
          "commit": {
            "sha": "fab6b36fafba",
            "author": {
              "avatar": "",
              "login": "",
              "name": "amitk \u003Camitk@somemail.com\u003E"
            },
            "date": "2024-05-09T12:55:20Z",
            "message": "KAN-13,KAN-14"
          },
          "type": "PULL_REQUEST",
          "key": "12",
          "status": {
            "qualityGateStatus": "OK"
          }
        }
      }

Its have the following attributes:
“violations_added”: “0”,
“violations_fixed”: “0”,
“sha”: “fab6b36fafba”,
“analysisDate”: “2024-05-09T12:56:11.819Z”,

and issues api return the following structure for issue:

  {
      "key": "AY9IhZFpNln50TcT7Yku",
      "rule": "go:ParsingError",
      "severity": "MAJOR",
      "component": "456357_component",
      "project": "456357_project",
      "flows": [],
      "resolution": "FIXED",
      "status": "CLOSED",
      "message": "A parsing error occurred in this file.",
      "effort": "30min",
      "debt": "30min",
      "author": "amitk@somemail.com",
      "tags": [
        "suspicious"
      ],
      "transitions": [],
      "actions": [
        "comment"
      ],
      "comments": [],
      "creationDate": "2024-05-05T12:44:06+0200",
      "updateDate": "2024-05-05T13:58:16+0200",
      "closeDate": "2024-05-05T13:58:16+0200",
      "type": "CODE_SMELL",
      "organization": "organization",
      "cleanCodeAttribute": "CONVENTIONAL",
      "cleanCodeAttributeCategory": "CONSISTENT",
      "impacts": [
        {
          "softwareQuality": "MAINTAINABILITY",
          "severity": "MEDIUM"
        }
      ]
    }

Its have the following attributes:
“closeDate”: “2024-05-05T13:58:16+0200”,

I thought about compare the closeDate of issue with analysisDate for a analysis that have some violations_fixed with a value that more than 0.
And by this way match the commit ID with the solved issue.

there is any simple way to do it? some internal API?

if not - there is any pagination for activity_feed api? p for page number not working, just ps for page size

Thanks!

Hi,

Welcome to the community!

Uhm… I would have told you the data wasn’t there to do it at all. So… no. :smiley:

 
Ann

I edit the task description.
There is any documentation of the parameters of the activity_feed api?

Hi,

The APIs are fully documented in-app. Take a look at the page footer or the ? in the top menu for the link.

 
HTH,
Ann