I want to create project with Web API.
curl --include \
--request POST \
--header "Content-Type: application/json" \
-u $SONAR_TOKEN: \
-d 'project=OurGithubOrg_repo-name-in-github&organization=some-org&name=some-project' \
'https://sonarcloud.io/api/projects/create'
But got error:
{"errors":[{"msg":"The 'project' parameter is missing"}]}
I want to know what is the problem?
mickaelcaro
(Mickaël Caro)
2
Hi,
Params have to be passed in the query string of the URL
So either do
curl --include \
--request POST \
-u $SONAR_TOKEN: \
'https://sonarcloud.io/api/projects/create?project=OurGithubOrg_repo-name-in-github&organization=some-org&name=some-project'
Or change the content type like this :
curl --include \
--request POST \
--header "Content-Type: application/x-www-form-urlencoded" \
-u $SONAR_TOKEN: \
-d 'project=OurGithubOrg_repo-name-in-github&organization=some-org&name=some-project' \
'https://sonarcloud.io/api/projects/create'
1 Like