API - error creating access rule (10019)

Very new to the cloudflare API.
I’m trying to add rule to block IP address.
Sending request to https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules
with headers X-Auth-Email, X-Auth-Key, Content-Type.
I also added the following json as raw body: ‘{“mode”:“block”,“configuration”:{“target”:“ip”,“value”:“198.51.100.4”}}’.
But I’m getting error response:

{
“result”: null,
“success”: false,
“errors”: [
{
“code”: 10019,
“message”: “firewallaccessrules.api.bad_json”
}
],
“messages”:
}

You either sent a bad content-type header or bad json. It looks valid based on what your put but something somewhere is breaking the json input.

1 Like