[SonarQube8.9.7] Sonarqube's API gives an "Insufficient privileges" error

Hello, Alain Kermis-san

Thank you for everything. Thank you very much for your help.
We were able to do NEW_CODE_PERIOD/set successfully, so this ticket is closed.

Our method is as follows.

Run api/project_analyses/search.
You can get this result for projects that have run sonar-scanner at least once.
Analyses will be added for each operation such as running sonar-scanner, changing a rule, etc.
When sonar-scanner is executed, the contents of events are either empty or events.category is VERSION.
The analyses.key for the date you want to retrieve will be the uuid when you next run api/new_code_periods/set with SPECIFIC_ANALYSIS.

{
  "paging": {
    "pageIndex": 1,
    "pageSize": 100,
    "total": 3
  },
  "analyses": [
    {
      "key": "A2",
      "date": "2016-12-12T17:12:45+0100",
      "projectVersion": "1.2.1",
      "buildString": "1.2.1.423",
      "revision": "be6c75b85da526349c44e3978374c95e0b80a96d",
      "manualNewCodePeriodBaseline": false,
      "events": [].
    }
  ]
}

Thank you for the long time.
makiyama


こんにちは、Alain Kermis-san

いつもありがとう。お世話になっております。
無事にNEW_CODE_PERIOD/setをすることが出来ましたので、このチケットはクローズします。

私達のやり方は以下の通りです。

api/project_analyses/searchを実行します。
この結果はsonar-scannerを1回以上実行しているプロジェクトで取得出来ます。
sonar-scannerを実行する、ルールを変更するなどの操作ごとにanalysesが追加されていきます。
sonar-scannerを実行したときのeventsの中身は、空か、events.categoryがVERSIONになっています。
取得したい日付のanalyses.keyが、次にapi/new_code_periods/setをSPECIFIC_ANALYSISで実行する際のuuidとなります。

{
  "paging": {
    "pageIndex": 1,
    "pageSize": 100,
    "total": 3
  },
  "analyses": [
    {
      "key": "A2",
      "date": "2016-12-12T17:12:45+0100",
      "projectVersion": "1.2.1",
      "buildString": "1.2.1.423",
      "revision": "be6c75b85da526349c44e3978374c95e0b80a96d",
      "manualNewCodePeriodBaseline": false,
      "events": []
    }
  ]
}

長いことありがとうございました。
makiyama

1 Like