I'm encountering an issue while attempting to generate a GLOBAL_ANALYSIS_TOKEN
using the SonarQube API. I'd appreciate any assistance or insights you can offer.
https://quality-analysis.my-company.io/sonar/api/user_tokens/generate
Here is the JSON payload I am sending:
{
"name": "TestingfromAPI",
"login": "ghassen@my-company.io",
"projectKey": "demo",
"type": "GLOBAL_ANALYSIS_TOKEN",
"expirationDate": "2023-10-30"
}
Upon sending the request, I receive the following error message:
{
"errors": [
{
"msg": "The 'name' parameter is missing"
}
]
}
Any guidance would be highly appreciated. Thank you!
Documentation says nothing about content type for sending parameters. I assume they do not support JSON as an input. You may try 'x-www-form-urlencoded' form instead.
curl -u user:password --data 'name=dummy_token_name&type=GLOBAL_ANALYSIS_TOKEN' -H 'Content-Type: application/x-www-form-urlencoded' http://localhost:9000/api/user_tokens/generate