Interacting with the Cloudflare API: "must include at least one condition or expression"?

I want to control a Cloudflare Zero Trust Gateway DNS rule via the Cloudflare API. I am using the “Update Zero Trust Gateway Rule” documented here, but it’s not working as expected.

According to the documentation, the request body has two required parameters, action and name. However, when I include both of those parameters, even in a basic request with a body that looks like this:

{
  "action": "allow",
  "name": "My Rule Name"
}

…my request is getting rejected with the following response:

{
  "result": null,
  "success": false,
  "errors": [
    {
      "message": "must include at least one condition or expression"
    }
  ],
  "messages": []
}

What “conditions” or “expressions” is it referring to in this context?

OK, I figured it out.

The “condition” or “expression” must be defined within the traffic property of the request body.

For example, this worked:

{
  "action": "allow",
  "enabled": false,
  "name": "My Rule Name",
  "traffic": "any(dns.domains[*] == \"example.com\")"
}

Nothing in the documentation or error message explains this.

The traffic property should be marked as Required in the documentation.