Hi there, does someone have an easy method of taking the out of the API call and exporting to CSV? I am trying to get a list of all the zones and if they are active or in a pending state…
curl -X GET “https://api.cloudflare.com/client/v4/zones ”
-H “Content-Type:application/json”
-H “X-Auth-Key:magickey”
-H “X-Auth-Email:[email protected] ”
The API typically (always?) outputs JSON. You can use jq to extract and format the results. Something like this should do the trick:
curl -X GET https://api.cloudflare.com/client/v4/zones -H "Content-Type:application/json" -H "X-Auth-Key:magickey" -H "X-Auth-Email:[email protected] " | jq -r '.result[] | "\(.name),\(.status)"'
3 Likes
michael:
flare.co
Thank you Michael, exactly what i wanted how do i get that to show more than 20 results? I have over 400 domains
In the API there is a per_page query parameter. Search for Pagination at https://api.Cloudflare.com
1 Like
Thanks again Michael, i’ve got it working
system
Closed
June 21, 2021, 11:55pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.