mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 20:41:49 +03:00
866476ab36
GITHUB_PR_NUMBER: 8011 GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8011 PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3317 Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> GitOrigin-RevId: 90c8f75003a07c5153c9e478efa599ab0bfb85d9
55 lines
1.9 KiB
ReStructuredText
55 lines
1.9 KiB
ReStructuredText
.. meta::
|
|
:description: Invoke event triggers manually on the Hasura console or over the API
|
|
:keywords: hasura, docs, event trigger, console, invoke
|
|
|
|
.. _invoke_trigger_manually:
|
|
|
|
Invoke event trigger manually
|
|
=============================
|
|
|
|
.. contents:: Table of contents
|
|
:backlinks: none
|
|
:depth: 1
|
|
:local:
|
|
|
|
.. rst-class:: api_tabs
|
|
.. tabs::
|
|
|
|
.. tab:: Console
|
|
|
|
You can select the ``Via console`` trigger operation while :ref:`creating an event trigger <create_trigger>`
|
|
to allow invoking the event trigger on rows manually using the Hasura console *(available after version v1.0.0-beta.1)*.
|
|
|
|
In the ``Data -> [table-name] -> Browse Rows`` tab, clicking the ``invoke trigger`` button next to any row lets
|
|
you invoke "manual event triggers" configured on the table with that row as payload *(the button will be shown
|
|
only if you have any triggers configured)*:
|
|
|
|
.. thumbnail:: /img/graphql/core/event-triggers/select-manual-trigger.png
|
|
:alt: Invoke event trigger on console
|
|
|
|
Click on the event trigger you want to run and a modal will pop up with the request and response.
|
|
|
|
.. thumbnail:: /img/graphql/core/event-triggers/run-manual-trigger.png
|
|
:alt: Request and response of event trigger
|
|
|
|
.. tab:: API
|
|
|
|
When creating an event trigger over the :ref:`metadata_pg_create_event_trigger` metadata API, you can set the argument ``enable_manual`` to true.
|
|
|
|
Then you can use the :ref:`metadata_pg_invoke_event_trigger` metadata API to invoke triggers manually:
|
|
|
|
.. code-block:: http
|
|
|
|
POST /v1/metadata HTTP/1.1
|
|
Content-Type: application/json
|
|
X-Hasura-Role: admin
|
|
|
|
{
|
|
"type" : "pg_invoke_event_trigger",
|
|
"args" : {
|
|
"source": "<db_name>",
|
|
"name": "send_email",
|
|
"payload": {}
|
|
}
|
|
}
|