method_StartAction.adoc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. = API Method: StartAction
  2. This is the method the OliveTin web UI uses to start actions, and is probably the best method to use if you are writing scripts.
  3. * **HTTP Method**: `POST`
  4. * **Request Type**: xref:api/start_action.adoc#api-request-startaction[StartAction request object] (`bindingId`, `arguments`, `uniqueTrackingId`, `justification`)
  5. * **Response Type**: Execution Tracking ID
  6. NOTE: `StartAction` selects the action with `bindingId`, not `actionId`. For a normal action, the binding ID is the same as the action `id` from your `config.yaml`. See xref:api/start_action.adoc#api-ids[Action IDs vs Binding IDs].
  7. There are several variants of this API call available which might be easier for scripts (or humans) to work with:
  8. include::partial$api/start_action_methods.adoc[]
  9. == Example API call: Start an action using `StartAction`
  10. [source,bash]
  11. .curl
  12. ----
  13. user@host: curl "http://olivetin.example.com:1337/api/StartAction" --json '{"bindingId": "nuclear_reactor_shutdown"}'
  14. {"executionTrackingId":"6ecda25d-b6e1-4621-898c-d4e6f2dbeda5"}
  15. ----
  16. [source,powershell]
  17. .Powershell
  18. ----
  19. PS C:\Users\xcons> $json = '{"bindingId": "deploy_attack_gnomes"}'
  20. PS C:\Users\xcons> Invoke-RestMethod -Method "Post" -Uri "http://olivetinServer:1337/api/StartAction" -ContentType "application/json" -Body $json
  21. ----
  22. == Example API call: Start an action using `StartAction` with arguments
  23. [source,bash]
  24. .curl
  25. ----
  26. user@host: curl 'http://olivetin.example.com:1337/api/StartAction' --json '{"bindingId": "Ping_host", "arguments": [{"name": "host", "value": "example.com"},{"name": "count", "value": "1"}]}'
  27. ----