cloudflare-python icon indicating copy to clipboard operation
cloudflare-python copied to clipboard

accounts/{account_id}/rules/lists/{list_id}/items body not supported

Open barbich opened this issue 7 months ago • 5 comments

Confirm this is a Python library issue and not an underlying Cloudflare API issue.

  • [x] This is an issue with the Python library

Describe the bug

hi The openapi defintiion for accounts/{account_id}/rules/lists/{list_id}/items has support for a requestBody but the library (python one, but also go, curl...) does not reflect this (and does not support it).

This is might be an issue in the openapi.yaml definition.

tx

To Reproduce

import os from cloudflare import Cloudflare

client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) item = client.rules.lists.items.delete( list_id="2c0fc9fa937b11eaa1b71c4d701ab86e", account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{"id":"1234567890abcd"}] )

Code snippets


OS

macOS

Python version

3.9.0

Library version

v4.0.0

barbich avatar Jun 30 '25 09:06 barbich

Hello, I have opened a bug on the team so they can take a look.

jhutchings1 avatar Jun 30 '25 21:06 jhutchings1

@jhutchings1 Not the OP, but do you have an ETA or any interim information on whether this is a documentation/OpenAPI issue, library implementation issue, or Cloudflare API issue?

CarsASolis avatar Jul 10 '25 20:07 CarsASolis

I've pinged the engineering team for an update on this and asked them to loop back on this. Thanks!

jhutchings1 avatar Jul 10 '25 20:07 jhutchings1

Thanks for your patience, we've just pushed a fix that should be in the next release

nlsandler avatar Jul 10 '25 21:07 nlsandler

For future reference, this ended up working for us:

curl -s "https://api.cloudflare.com/client/v4/accounts/<account_id_hash>/rules/lists/<list_id_hash>/items" \
  -X DELETE \
  --header "Authorization: Bearer $cf_token" \
  --header 'Content-Type: application/json' \
  -d '{"items":[{"id":"<item_id_hash>"}]}'

CarsASolis avatar Jul 21 '25 22:07 CarsASolis