Issues with Web API v2

I’m trying to call the basic example

curl --request GET \
  --url 'https://api.sonarcloud.io \
  --header 'Authorization: Bearer <my_token>'

where of course I’m replacing <my_token> with an actual token I generated from SonarQube CLoud’s Web UI.

I only receive “403 Forbidden” responses.

If I invoke some endpoint, like the /projects one, I receive the following error:

{
“message”: “Invalid key=value pair (missing equal-sign) in Authorization header (hashed with SHA-256 and encoded with Base64): ‘[REDACTED+’.”
}

Using the same token I can invoke API v1 without any issue, so I really don’t understand what’s wrong.

Can you help me, please?

Hello! Although it’s not immediately obvious from the documentation, the correct endpoint to use is https://api.sonarcloud.io/projects/projects.

This issue has already been reported internally. Resolving it unfortuantely isn’t straightforward, but we want to fix it in the near-term.

This guide might help you reverse engineer specific endpoints.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.