1

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.

  • Jenkins version is 2.210
  • Apache HTTPd is used as a reverse-proxy
  • OS is Centos 7.x
  • User is configured (Active Directory user)
  • User has relevant permissions (Global "Read", + Job "Read","Workspace" and "Build")
  • User has an API_TOKEN generated
  • Pipeline job has an authentication token defined

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?

donmelchior
  • 893
  • 3
  • 13
  • 31

1 Answers1

0

I found a similar question:

passing parameter to jenkins job through curl POST not working?

can you try the curl -F ?

wia
  • 186
  • 2
  • 13