3

I need to call a Jenkins job using its API through Postman. This job requires parameters (HOST, VERBOSITY and PMSP).

Auth works using Jenkins token and header Content-type:application/json is used.

{
        "parameter": [
            {
                "name": "HOSTS",
                "value": "[linux]\n1.2.3.4"
            },
            {
                "name": "VERBOSITY",
                "value": "vv"
            },
            {
                "name": "SANS_PMSP",
                "value": true
            }
        ]
}

Is my JSON well constructed ? Which endpoint do I need to call ?

vmele
  • 95
  • 1
  • 10
  • are you looking for this --> https://wiki.jenkins.io/display/JENKINS/Remote+access+API ?? ex - curl -X POST JENKINS_URL/job/JOB_NAME/build --user USER:TOKEN --data-urlencode json='{"parameter": [{"name":"id", "value":"123"}, {"name":"verbosity", "value":"high"}]}' – Rohit Jindal Apr 09 '19 at 09:49
  • 1
    I tried the solution with Curl and it works like a charm. But i'd like to **focus on Postman** ! – vmele Apr 09 '19 at 10:06
  • 2
    This is what you want. https://stackoverflow.com/questions/27957943/simulate-a-specific-curl-in-postman – Milan Apr 09 '19 at 11:27
  • I have tested with https://stackoverflow.com/questions/27957943/simulate-a-specific-curl-in-postman and it is working. – Rohit Jindal Apr 09 '19 at 12:33
  • Thank you, that's perfect ! Good to know this – vmele Apr 10 '19 at 07:06

1 Answers1

4

If it's Postman that you would like to focus on, you can import the curl command straight into the application.

Postman curl

This creates a new request for you to use and it populates this request, based on the details in the command.

Postman

From here, you should be able to add your own URL and point this at the location you need.

Danny Dainton
  • 23,069
  • 6
  • 67
  • 80