method_StartActionAndWait.adoc 1.0 KB

12345678910111213141516171819202122
  1. = API Method: StartActionAndWait
  2. This method is useful is you are writing a script, and want to wait for the action to finish so that you can check the result, or get the output.
  3. * **HTTP Method**: `POST`
  4. * **Request Type**: xref:api/start_action.adoc#api-request-startactionandwait[StartActionAndWait request object] (`actionId`, `arguments`, `justification`)
  5. * **Response Type**: Log Entry (waits for the action to finish)
  6. There are several variants of this API call available which might be easier for scripts (or humans) to work with:
  7. include::partial$api/start_action_methods.adoc[]
  8. == Example API call: Start an action with arguments, and wait for it to finish
  9. [source,bash]
  10. .curl
  11. ----
  12. user@host: curl 'http://olivetin.example.com:1337/api/StartActionAndWait' --json '{"actionId": "Ping_host", "arguments": [{"name": "host", "value": "example.com"}]}'
  13. {"logEntry":{"actionTitle":"Ping host","output":"...","exitCode":0, ... }}
  14. ----
  15. See xref:api/start_action.adoc#api-response-logentry[Response type: LogEntry] for the full response.