1
votes

I tried to run the Jenkins job using "CURL" command but getting the below error

C:\Users\gd\Downloads\curl-7.66.0_2-win64-mingw\curl-7.66.0-win64-mingw\bin>

curl -X POST http://slack:[email protected]:8080/job/test-job/build
curl: (6) Could not resolve host: http

curl -X POST http://slack:[email protected]:8080/job/test-job/build

when we hit that command from the command prompt, immediately Jenkins job should run in the Jenkins

enter image description here

2

2 Answers

0
votes

You can use any one of the below to trigger the pipeline:-

curl -X POST slack:11cf86296e48e9c5c3a8570aa1ccfc57a8@<Jenkinshost>:8080/job/test-slack/build

curl -X POST http://slack:11cf86296e48e9c5c3a8570aa1ccfc57a8@<Jenkinshost>:8080/job/test-slack/build
0
votes

For could not resolve POST: make sure to use -X, not -x

curl -X POST ...

You seem to have an extra http:// in the middle of your URL:

http://slack:11cf86296e48e9c5c3a8570aa1ccfc57a8@http:///:8080/job/test-slack/build
                                                ^^^^^^^
 Try instead to use "<ipaddress>" (to be replace by the actual Jenkins IP address)

http://slack:11cf86296e48e9c5c3a8570aa1ccfc57a8@<ipaddress>:8080/job/test-slack/build

Using a fully qualified named instead of an IP address would be preferable, but both should work.