Unable to get response from Sonarqube web api endpoints in Postman

Hi Team,

Goal: I am trying to get code coverage, severity data from Sonarqube cloud.

I am making use of Postman to test Sonarqube webapi endpoints but not getting desired result.
(Note: Generated token in Sonarqube and provided it in Postman token_bearer)

example GET API:

Output: getting random HTML code, with 200 OK status

<!doctype html>

. . . ]

Desired output should be like below.

“tags”: [

I have tried most of the endpoints, the result is same, random HTML code.

Below are some the API. I have tried,
(All get requests)

(Component key is optional)


What is the right way to consume the sonarqube endpoints?

Thanks in advance.

1 Like


Welcome to the community!

You said “Sonarqube cloud”. I guess you mean SonarQube? If so, then what you’ve listed is correct. E.G. https://next.sonarqube.com/sonarqube/api/project_tags/search.

You say you keep getting random HTML code. Have you looked at what the returned page says? It may be relevant to your problem.


Hi Ann,

Thanks for your reply,
I analysed the response from the API, it does not have any valid information.

What is the correct way to call SonarQube web APIs from postman?

Thanks for your time.


I tried with Java code…

message attribute is empty.



The user token isn’t a bearer token, the SonarQube API uses HTTP basic authentication.


User Token

This is the recommended way. Benefits are described in the page User Token. The token is sent via the login field of HTTP basic authentication, without any password.

1 Like

Hi Felipe,

Used basic auth, the result is same.


Let’s back up. Log in to SonarQube with your browser and try calling the API directly (in your browser location bar). What do you get? Because based on the screenshots, it looks like you may be being redirected to the SonarQube app.


Hi Ann,

When I hit api directly in browser


It redirects to

Yes, you are right, it is redirected back to SonarQube app.


So to solve this issue, you’ll need to deal with the redirect. Then you should be able to use Postman without a problem.


1 Like

Hi Ann,

Thanks for the reply,
Do you know on how to handle these redirects?
Any settings we need to change within Sonarqube

Much Appreciated.


Hi Praveen,

This isn’t happening within SonarQube. You probably need to talk to your network folks.


1 Like

Thanks a lot Ann.

Much Appreciated!!


Looks like you need to call https://sonar.pnr.com/sonar/api/measures/component?metricKeys=coverage
Istead of https://sonar.pnr.com/api/measures/component?metricKeys=coverage

1 Like

Yes, @nixel2007

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