GTP_Jordan
05/18/2023, 5:00 AMconst url = `https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/gateway/rules/${POLICY_ID}`;
const response = await fetch(url, {
method: 'PUT',
headers: {
'X-Auth-Email': API_EMAIL,
'Authorization': `Bearer ${API_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: "block",
enabled: false,
})
});
This code is intended to disable the rule. But when I run it I just get an error:
{
"result": null,
"success": false,
"errors": [
{
"message": "must include at least one condition or expression"
}
],
"messages": []
}
I don't understand what "must include at least one condition or expression" means in this context. I also don't understand what the action
string is supposed to do or how it should be used correctly.
If anyone could help me understand this I would really appreciate it. Thanks!