I made necessary setup to allow a Jenkins pipeline job to be triggered remotely using its REST API. I'm now testing build trigger using curl.
Builds are triggered properly but none of the build parameters are detected.
Build history shows that no parameter passed in POST are detected. Only those with a default value have it displayed instead of value passed in POST request.
curl -k -X POST https://<Jenkins URL>/job/<my job name>/buildWithParameters?token=XXXXXXXXXXXXXX --user <user>:<API TOKEN> --data-urlencode json='{"parameter": [{"PARAM1": "true"},{"PARAM2": "foo"},{"PARAM3": "X.X.X.X"}]}'
I'm confused because this seemed to be the proper way to trigger a build using Jenkins API. How to properly trigger a pipeline job using the REST API and POST requests?
I found a similar question:
passing parameter to jenkins job through curl POST not working?
can you try the curl -F
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With