Updating Bot Fight Mode

The docs here say that this is the link to update Bot Fight Mode:

This is the example:

curl --request PUT \
  --url https://api.cloudflare.com/client/v4/zones/zone_identifier/bot_management \
  --header 'Authorization: Bearer undefined' \
  --header 'Cloudflare-Version: ' \
  --header 'Content-Type: application/json'

and it says that I need to change fight_mode to true. But the docs don’t say HOW to do that. Running it as noted just returns the current values, of course.

Based on other examples, I made this educated guess:

curl --request PUT \
  --url https://api.cloudflare.com/client/v4/zones/zone_identifier/bot_management \
  --header 'Authorization: Bearer undefined' \
  --header 'Cloudflare-Version: 2.0.0' \
  --header 'Content-Type: application/json'
  --data '{
	"fight_mode": "true"
  }'

but had this error:

json: cannot unmarshal string into Go struct field ZoneJSON.fight_mode of type bool

What’s the proper way to send the “flight_mode” param?

I believe in this case you will need to remove the quotes around that true, so instead of "fight_mode": "true" try "fight_mode": true.

Ha, good call! That worked :slight_smile:

Who do you email to ask them to correct the docs?

You mentioned that you made the --data part as an educated guess, so I’m a bit confused what exactly needs to be corrected in the docs?

The example on the doc page should include the data parameter. If this was someone’s first time, there’s no way they would have never been able to guess any of that.

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