Must-share information (formatted with Markdown):
- SonarQube 6.7
- Programmatically setup web-hooks
- I have tried by postman, it works
We like to run a bash script to setup web-hooks programmatically, but always get 400 code without any response body. the response is like:
POST /api/settings/set?key=sonar.webhooks.project&fieldValues={“name”:“Server_Stage”,“url”:“https://analytics-stage.our.sever.com/hooks/sonarqube”}&component=com.company.platform.observability:projectname:master HTTP/2
Host: our.server.company.com
Authorization: Basic TOKEN
User-Agent: curl/7.54.0
Accept: /
- Connection state changed (MAX_CONCURRENT_STREAMS updated)!
HTTP/2 400
server: nginx/1.14.1
date: Tue, 19 Mar 2019 15:14:55 GMT
Below are the curl requests:
curl -g -X POST -u ADMIN_API_TOKEN: -v ‘https://our.server.com/api/settings/set?key=sonar.webhooks.project&component=com.company.platform.observability:projectname:master&fieldValues={“name”:“Server_Stage”,“url”:“https://server-stage.our.server.com/hooks/sonarqube”}’
curl -g -X POST -u ADMIN_API_TOKEN: -v ‘https://our.server.com/api/settings/set?key=sonar.webhooks.project&component=com.company.platform.observability:projectname:master&fieldValues={“name”:“Server_Stage”,“url”:“https://server-stage.our.sever.com/hooks/sonarqube”}’
We can successfully called other APIs like api/qualitygates/select or list but only this one not working. I guess there is something wrong with the query strings/parameters.
The wired thing is I tried to copy paste code from postman, it is not working either, but if I directly send message from postman it works.
Could you possibly help me to take a look whether something wrong my curl requests, many thanks in advance.