Reputation: 51
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?
Upvotes: 4
Views: 4113
Reputation: 7626
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.
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
Upvotes: 2
Reputation: 1323953
Try first a regular curl call, as in this answer
curl -X POST -u "user" "http://myjenkins/path/to/my/job/buildWithParameters?value1=value1¶m2=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.
Upvotes: 3