method_StartActionByGet.adoc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. = API Method: StartActionByGet
  2. This is the simplest method to start an action - you only need to send the action ID, which makes it a good fit for quick integrations (Stream Deck, Home Assistant, cron jobs, etc). You cannot pass arguments using this method.
  3. * **HTTP Method**: `POST`
  4. * **Request Type**: xref:api/start_action.adoc#api-request-actionid[Action ID only] (`actionId`)
  5. * **Response Type**: Execution Tracking ID
  6. [NOTE]
  7. ====
  8. Despite the name, in OliveTin 3k this method is called with `POST` and a JSON body, the same as every other API method. The OliveTin 2k style of putting the action ID in the URL (eg: `GET /api/StartActionByGet/pingGithub`) is no longer supported and returns `404`.
  9. ====
  10. include::partial$api/start_action_methods.adoc[]
  11. [#api-eg-startActionId]
  12. == Example API call: Start an action by ID
  13. .curl
  14. ----
  15. user@host: curl http://olivetin.example.com:1337/api/StartActionByGet --json '{"actionId": "pingGithub"}'
  16. {"executionTrackingId":"ff7d6f13-af8f-4ebe-8174-ad4cc7197b45"}
  17. ----
  18. The corresponding config.yaml would look like this;
  19. [source,yaml]
  20. ----
  21. actions:
  22. - title: Ping GitHub.com
  23. id: pingGithub
  24. shell: ping github.com -c 1
  25. ----
  26. IDs are used by these API calls, as you probably want the interface to display a human-readable title, whereas the API call doesn't want to have spaces or punctuation.