最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

bash - CURL to find CloudFlare Rule ID (so I can delete it) For a specific IP using CloudFlare API - Stack Overflow

programmeradmin8浏览0评论

I've got this code which produces a JSON response with a lot of IP addresses in it, which I suspect are the most recent IP block rules in my CloudFlare account. I think it's ignoring my request to filter for a specific IP. What am I doing wrong?

Note that this is run with the global 'account' level API key because I have multiple domains sharing the same global IP blocking rules.

curl -s -X GET "; -H "X-Auth-Email: CLOUD_FLARE_ACCOUNT_EMAIL" -H "X-Auth-Key: CLOUD_FLARE_ACCOUNT_API_KEY" -H "Content-Type: application/json" --data '{ "filter": { "ip": { "eq": "123.123.123.123" } } }'

It responds with a page of IP addresses even if 123.123.123.123 is NOT a blocked IP rule.

I presume the filter option is not being respected at all.

I've got this code which produces a JSON response with a lot of IP addresses in it, which I suspect are the most recent IP block rules in my CloudFlare account. I think it's ignoring my request to filter for a specific IP. What am I doing wrong?

Note that this is run with the global 'account' level API key because I have multiple domains sharing the same global IP blocking rules.

curl -s -X GET "https://api.cloudflare/client/v4/user/firewall/access_rules/rules" -H "X-Auth-Email: CLOUD_FLARE_ACCOUNT_EMAIL" -H "X-Auth-Key: CLOUD_FLARE_ACCOUNT_API_KEY" -H "Content-Type: application/json" --data '{ "filter": { "ip": { "eq": "123.123.123.123" } } }'

It responds with a page of IP addresses even if 123.123.123.123 is NOT a blocked IP rule.

I presume the filter option is not being respected at all.

Share Improve this question asked Mar 20 at 17:03 ClaudClaud 9971 gold badge12 silver badges28 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

This command format works:

curl -s -X GET "https://api.cloudflare/client/v4/user/firewall/access_rules/rules?configuration.target=ip&configuration.value=$IP" -H "X-Auth-Email: $CLOUDFLARE_EMAIL" -H "X-Auth-Key: $CLOUDFLARE_API_KEY" -H "Content-Type: application/json"

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论