Triggering a Jenkins build from Microsoft Power Automate

Jenkins setup: Unknown (working on a client installation)

I am attempting to trigger a build job from Power Automate over the remote access REST API, the build will take user input into the job which I need to pass to the build job over REST API.

Does anyone have any examples of how this is done?

The following curl command works and passes the parameters into the build job, but what format do I need to put this into to be accepted as part of a REST payload?

curl -k -X POST -u “accountname” https://[instance URL]/[job/path]/build --form json=‘{“parameter”:[{“name”:“FIELD_NAME”, “value”:“value-to-insert”}]}’

I’ve tried the following in the body of the request, but it returns a 400 error indicating a bad syntax.

{
“parameter”: [
{“name”:“FIELD_NAME”, “value”:“value-to-insert”}]
}

Does anyone know how an array of parameters would be passed as valid JSON?

Any advice or guidance would be greatly appreciated.

Hello and welcome to this community, @PowerAppy. :wave:

Could your issue be linked to the incorrect use of quotation marks in your JSON payload?
I think that in JSON, you should use straight double quotes (") instead of curly quotes (“ and ”). It may just be a copy-and-paste problem, I don’t know. :person_shrugging:

Here’s how you could format your JSON payload:

{
  "parameter": [
    {
      "name": "FIELD_NAME",
      "value": "value-to-insert"
    }
  ]
}

In the context of a curl command, you can use the -d or --data option to send the JSON payload:

curl -k -X POST -u "accountname" https://[instance URL]/[job/path]/build \
  -H "Content-Type: application/json" \
  -d '{
    "parameter": [
      {
        "name": "FIELD_NAME",
        "value": "value-to-insert"
      }
    ]
  }'