4

I tried "build with parameters" for my jenkins job and after providing parameters through jenkins Dashboard, browser opens and displays satisfactory results.But on trying the same things through "postman" application , it built succesfully and opens the empty browsers(without any results). what could be the problem? can someone help please?

user8663500
  • 51
  • 1
  • 3

2 Answers2

3

Try first a regular curl call, as in this answer

curl -X POST -u "user" "http://myjenkins/path/to/my/job/buildWithParameters?value1=value1&param2=value2

Once that is working, you can report them on Postman easily enough.

But double-check the exact names of the build parameters on your Jenkins job.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
2

How to get api_token_for_use? Manage Jenkins > Manage Users > Select your user > configure > get the API Token for user (create if you don't have one)

How to get job_authentication_token? Select jenkins job > Trigger builds remotely (e.g., from scripts) > Authentication Token

Now, you can use curl as below,

curl -X POST -u username:api_token_for_user http://yourjenkins.com/job/yourJenkinsJob/buildWithParameters?token=job_authentication_token

To import that into postman.

Import and paste the entire curl command. Postman will import your pasted content. Your -u username:api_token_for_user will get imported as Basic Auth Type in Postman. See below picture for reference.

enter image description here

You can even do a build with parameters where you can pass parameters in POST request or pass in a Body as a form-data or pass as a body as raw>JSON

enter image description here enter image description here

Uddhav P. Gautam
  • 7,362
  • 3
  • 47
  • 64