0

I am trying to run the below CURL command to trigger a JENKINS job with huge list of parameters. Job gets submitted , but it does not read my parameters that i sent , instead picks up the defaults.

curl -v -X POST \
'https://jenkins_URL/buildWithParameters?' \
-H 'Content-Type: application/json' \
--user ABC:token \
--form json='{\"parameter\":[{\"name\":\"ACTION\", \"value\":\"ONBOARD_NEWUSECASE"\  } \
,{\"name\":\"Name\", \"value\":\"ABC\"} \
,{\"name\":\"Number\", \"value\":\"123456789\"} \
,{\"name\":\"sample\", \"value\":\"SAMPLE\"} \
,{\"name\":\"A1\", \"value\":\"V1\"} \
,{\"name\":\"A2\", \"value\":\"V2\"} \
,{\"name\":\"A3\", \"value\":\"V3\"} \
]}'
file://policy.json

can someone please help me to fix this ?

Minal G
  • 3
  • 1
  • https://stackoverflow.com/questions/42946863/passing-parameter-to-jenkins-job-through-curl-post-not-working [This link worked for me . ](https://stackoverflow.com/questions/42946863/passing-parameter-to-jenkins-job-through-curl-post-not-working) – Minal G Jun 09 '21 at 05:01

1 Answers1

1

Instead of submitting the content as Json you can just pass parameter as query parameters.
Try the following:

curl -X POST -ABC:token "https://jenkins_URL/buildWithParameters?\
ACTION=ONBOARD_NEWUSECASE&\
Name=ABC&\
Number=123456789&\
sample=SAMPLE&\
A1=V1&\
A2=V2&\
A3=V3"
Noam Helmer
  • 5,310
  • 1
  • 9
  • 29