Update WAF custom rule through API via powershell

I want to creat powershell script which will be update my WAF custom rule .

I try to do this:

$Headers [email protected]{
“Authorization” = “Bearer fGE1S7xxxxxxxxxxxxxxxxxxxx”
“Content-Type” = “application/json”

$data = @{
id = “3057d5afe8a5454fa93xxxxxxxxxxx”;
Pause = $false;
description = “Restrict access from these browsers on this address range.”;
ref = “FIL-100”;
expression = ‘[not ip.geoip.country in {/“DE/” /“NL/”} and not ip.src in $list_001_rule]’

} | ConvertTo-Json

Invoke-RestMethod -Method PUT -Uri “https://api.cloudflare.com/client/v4/zones/3304b2650a7xxxxxxxxx/filters” -Headers $Headers -Body $data -ContentType “application/json”

But every time i get “Bad request 400”

Could You help me?

expression doesn’t work( i tryed any variants

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.