API: Silence check without subscription

According to the documentation, silences can be applied to subscriptions or checks. If a silence is applied to an subscription, a wildcard is provided for the check, and vice versa.

From the Web UI, I can manually create a silence for a specific check and not specify the subscription. The result is that the check is applied to all subscriptions/entities.

For example, if I create a new silence for a check called check_salt_procs and leave subscription field blank, I get the following silence: *:check_salt_procs

The API seems to behave differently and I’ve been unable to successfully create the same silence.

If I try to submit my request without a subscription, the backend returns a 400.
If I include the name of the targeted subscription (which is not desirable for this use case), the entry name of the silence becomes the name of the subscription.

For example, if I define subscription in my request as "subscription": "salts", my silence becomes salts:*

Is this type of silence via the API possible? And if so, is there an example of a check silence without a subscription anywhere? The reference examples only appear to cover subscriptions.

I was able to create a silence similar to what you are saying, I believe, using the following:

curl -X PUT -H "Authorization: Key $SENSU_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
  "metadata": {
    "name": "*:http",
    "namespace": "default",
    "labels": null,
    "annotations": null
  },
  "expire": -1,
  "expire_on_resolve": false,
  "creator": "admin",
  "check": "http",
  "reason": "Testing"
}' \
http://127.0.0.1:8080/api/core/v2/namespaces/default/silenced/*:http

This results in:

sensuctl silenced list
   Name    Subscription   Check          Begin          Expire   ExpireOnResolve   Creator   Reason   Namespace
 ──────── ────────────── ─────── ───────────────────── ──────── ───────────────── ───────── ──────── ───────────
  *:http                  http    20 Oct 20 12:10 UTC   -1s      false             admin     test     default