【问题标题】:Trigger Rundeck Job via API通过 API 触发 Rundeck 作业
【发布时间】:2016-02-17 10:15:03
【问题描述】:

Rundeck 支持通过其 API 触发作业。 API 文档位于documentation

我们使用的 API 版本 13 尚不支持 application/json。因此我需要使用基于 XML 的请求。

在我之前的尝试中,我总是得到响应:

<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>

由于没有提供示例请求,我正在搜索示例有效负载以触发作业。

正如响应中所见,我必须提供参数“容器”和“版本”,因为它们是必需的。

我最近的请求负载是:

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

我还尝试了此有效负载的不同变体,每次都具有相同的响应。

【问题讨论】:

    标签: rundeck


    【解决方案1】:

    这应该会对您有所帮助,假设您有一个令牌可以访问 Rundeck 并获得运行作业的授权

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-15
      • 2022-12-03
      • 1970-01-01
      • 2023-02-26
      • 1970-01-01
      相关资源
      最近更新 更多