4

Rundeck supports triggering jobs via their API. The API documentation is available under documentation.

We are using API version 13 which does not yet support application/json. Therefore i need to use the XML based request.

In my previous attempts, i always get the response:

<result error="true" apiversion="13"> <error code="api.error.job.options-invalid"> <message>Job options were not valid: Option 'container' is required. Option 'version' is required. </message> </error> </result>

Since there is no example request provided, i am searching for an example payload to trigger the job.

As seen in the response i have to provide the parameters "container" and "version" since they are required.

My most recent request payload was:

<executeJob> <argString>-container containerName -version 1234567</argString> </executeJob>

I also tried different variations of this payload, every time with the same response.

sebastian
  • 813
  • 1
  • 7
  • 14

1 Answers1

11

This should help you, assuming you have a token to access Rundeck with authorization to run the job

curl -D - -X "POST" -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "X-Rundeck-Auth-Token: <TOKEN>" \
    -d '{"argString":"-arg1 val1 -arg2 val2"}' \
http://<URL>/api/16/job/<JOB_ID>/executions
Pierre
  • 2,552
  • 5
  • 26
  • 47
swapz83
  • 422
  • 4
  • 11
  • This helped tremendously. I was able to take this and use it for a webhook URL in Grafana 9 alerting. I just used "https://myrundeck/api/41/job//executions?authtoken=" for the webhook and it worked great. :) – DevOpsSauce Dec 27 '22 at 17:53