/api/webhooks/list endpoint problem

It seems I can’t get the v1 API to list webhooks. For me it always results in a 401 error.

curl --silent   --header ‘Authorization: Bearer TOKEN’  -H ‘accept: application/json’ -X GET  ‘https://sonarcloud.io/api/authentication/validate’ | jq
{“valid”: true}
curl --silent   --header 'Authorization: Bearer TOKEN'  -H 'accept: application/json' -X GET  'https://sonarcloud.io/api/webhooks/list?organization=testing-terraform-provider-sonarcloud' | jq
{"errors":[{"msg":"Authentication is required"}]}

Same for another org in our enterprise. It’s a personal token I’m using and I’m admin/owner in both orgs (and enterprise).

I can query other endpoints. Components search for example.

curl --silent   --header 'Authorization: Bearer TOKEN'  -H 'accept: application/json' -X GET  'https://sonarcloud.io/api/components/search?organization=testing-terraform-provider-sonarcloud'  | jq
{
"paging": {
"pageIndex": 1,
"pageSize": 100,
"total": 2
},
"components": [
{
"organization": "testing-terraform-provider-sonarcloud",
"key": "xajzcfsxvasonarcloud-provider-acc-test_a",
"name": "project_a",
"qualifier": "TRK",
"project": "xajzcfsxvasonarcloud-provider-acc-test_a"
},
{
"organization": "testing-terraform-provider-sonarcloud",
"key": "testing-terraform-provider-sonarcloud_sonarcloud-testing-repo",
"name": "sonarcloud-testing-repo",
"qualifier": "TRK",
"project": "testing-terraform-provider-sonarcloud_sonarcloud-testing-repo"
}
]
}

Am I doing something wrong or is there a problem with the webhooks/list endpoint?

Hi,

First, I get "valid": true for the first endpoint, even before I log in. So… :woman_shrugging:

For the second, I again get the same answer you do. Until I log in. Then I get an ‘insufficient privileges’ response.

Can you share what you’re trying to accomplish?

 
Thx,
Ann

We’re maintaining a/the terraform provider for Sonarcloud. This situation came up when I tried to re-enable some tests for the webhooks resource/data source that the previous maintainer had disabled.
I assume for the same root cause, but I can’t ask them.

Hi,

Okay, so in this cause I would eavesdrop on the UI to make sure you’re hitting the right endpoint in the right way.

If you are, then it’s time to look at your authentication.

 
HTH,
Ann