Using rest API with user token

Using SonarQube 7.9.1.27448

I want to get the information from the projects index.
If I use the curl command with userid:ww I get the right information
If I use the same curl command except using a token, I get the 401 Unauthorized

What is wrong?

commands I used:

curl -v -L -u userid:password http://dev-svc.in.kadaster.nl/sonar/api/projects/index ==>> ok

curl -v -L http://dev-svc.in.kadaster.nl/sonar/api/projects/index?token=xxxxxxxxxxxxxx ==>> notok
I get a 401

hello, have you tried what is recommended here ?

# note that the colon after the token is required in curl to set an empty password 
curl -u THIS_IS_MY_TOKEN: https://sonarqube.com/api/user_tokens/search

Hallo Pierre,

Thanks for your quick reply.

That option also works well.

But I have to use the token=xxx version, if that is possible within the SonarQube API call.

I have to validate within an excel module to our SonarQube instance, and at this time I only can provide the module with an URL

I’m sorry, but it’s not possible to use token as parameter of the web services.

Julien,
That’s too bad. But thanks for your quick reply.
I wil look for an other option.

I’m also facing issue with API.
I tried using the token but it doesn’t work and I’m getting 401 error.
curl -v -D- -u myTokenHere: -X GET -H “Content-Type: application/json” https://sonar.url.net/api/editions/show_license

curl -v -D- -u username:myTokenHere -X GET -H “Content-Type: application/json” https://sonar.url.net/api/editions/show_license

but if I use my username and password the same works. Is there any limitation to the use of token.
curl -v -D- -u username:password -X GET -H “Content-Type: application/json” https://sonar.url.net/api/editions/show_license