Skip to content

Latest commit

 

History

History
74 lines (68 loc) · 1.73 KB

webhook.mdx

File metadata and controls

74 lines (68 loc) · 1.73 KB
title sidebarTitle description
Running a test via webhook
Webhook
How to run tests by sending a webhook.
While you can trigger test runs using webhooks, we highly recommend using the [Momentic CLI](/docs/cli) for interacting with Momentic's API.

You can trigger a test run by sending a POST request to a webhook URL. This can be useful if you want to trigger a test run in your CI pipeline. Make sure to generate an API key in the Momentic app first.

Running a single test

```bash curl -X POST \ -H 'Authorization: Bearer ' \ -H "Content-Type: application/json" \ 'https://api.momentic.ai/v1/tests/d8c4ee5c-bb47-4471-bbe1-93cbfef49fb4/queue' ``` ```js fetch("https://api.momentic.ai/v1/tests/d8c4ee5c-bb47-4471-bbe1-93cbfef49fb4/queue", { method: "POST", headers: { Authorization: 'Bearer ', "Content-Type": "application/json" }, }) ```

Running multiple tests

```bash curl -X POST \ -H 'Authorization: Bearer ' \ -H "Content-Type: application/json" \ 'https://api.momentic.ai/v1/tests/queue' \ --data-binary @- << EOF { "testIds": [ "d8c4ee5c-bb47-4471-bbe1-93cbfef49fb4", "d8c4ee5c-bb47-4471-bbe1-93cbfef49fb4" ] } EOF ``` ```js fetch("https://api.momentic.ai/v1/tests/queue", { method: "POST", headers: { Authorization: 'Bearer ', "Content-Type": "application/json" }, body: JSON.stringify({ testIds: [ "d8c4ee5c-bb47-4471-bbe1-93cbfef49fb4", "d8c4ee5c-bb47-4471-bbe1-93cbfef49fb4" ] }) }) ```