Run API tests from a deploy hook with a trigger URL
Some systems that should start your API tests can't install a CLI. A deploy tool with a "call this URL when done" box, a Git host webhook, a cron service, a chat bot. For those, a collection, a folder or a test suite can have a trigger URL: call it, and the run happens on the Requestarium server.
Create one
- Open the Runs panel of a collection or folder, or open a saved suite in Tests and go to its Settings tab.
- Press Trigger URL ▸ Create trigger URL.
- Copy the URL. It's shown once. Anyone who has it can start runs, so store it like a password. Replace token issues a new URL and stops the old one at once.
You need permission to edit collections and to send requests.
Call it
curl -X POST "https://api.requestarium.com/hooks/runs/rqr_…" \
-H 'Content-Type: application/json' -d '{"version":"1.4.2"}'Choose how it answers:
| Answer | Behaviour |
|---|---|
| At once (default) | 202 Accepted; the run continues on the server |
| After the run | waits up to 2 minutes; 200 when every request passed, 422 when something failed, with the counts and run ids |
"After the run" is what you want in a pipeline: most CI steps fail on a non-2xx answer, so the deploy job fails with your tests.
curl -fsS -X POST "$REQUESTARIUM_TRIGGER_URL" -d '{}' || exit 1Every run appears under Runs with the source hook, and counts for status badges and notifications like any other saved run.
Only accept signed calls
Turn on Require a signature. Each call then needs a header with the HMAC-SHA256 of the raw body, keyed with the signing secret (shown once):
BODY='{"version":"1.4.2"}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SIGNING_SECRET" | sed 's/^.* //')
curl -X POST "$REQUESTARIUM_TRIGGER_URL" \
-H "X-Requestarium-Signature-256: sha256=$SIG" -d "$BODY"GitHub's X-Hub-Signature-256 header is accepted too, so a GitHub repository webhook can call the trigger URL directly with the same secret. Unsigned or wrongly signed calls get 401 and run nothing.
Use values from the call
Run variables of a trigger URL can take values from the request that started it:
{{hook.body.version}}
{{hook.query.branch}}
{{hook.headers.x-request-id}}
{{hook.body.commits.0.id}}They override the environment's values for that run, the same way --var does in the CLI. A deploy hook that posts the preview URL can point the whole run at that deployment.
What runs where
The requests are sent from the Requestarium server, so the API has to be reachable from it: public or staging URLs on Requestarium Cloud, anything your installation can reach when you self-host. For services on localhost or a private network, run the CLI in your pipeline instead.
HTTP and GraphQL requests run on the server. gRPC and WebSocket requests are listed as skipped.
Errors
| Status | Meaning |
|---|---|
401 | A signature is required and missing or wrong |
404 | Unknown or turned-off URL |
410 | The collection, folder or suite was deleted |
429 | Too many calls: 60 a minute per URL |