Get only those zones with specific plan type

#1

Is there a way to use the API to get a filtered list of only those zones with a specific plan type?
For example, rather than returning all zones within an account, return only those zones subscribed to the Pro Plan.

0 Likes

#2

You cant filter with the request, but you can filter the subsequent dataset.

Something of that sort could do the trick

response.result.filter( v => v.plan.name === 'Pro Plan' );
0 Likes

#3

Thank you sandro. I knew that I could filter the full list on my own end, but pulling the full list will be a waste of bandwidth since the full list is very large. Pulling the entire list also means many more API requests than would be strictly necessary since there is a limit of only 50 zones per response. In understand about the need for limiting that to 50–I read in another post the reason for limiting the API response to 50 is to avoid overloading the system and to minimize impact to other API users when there are high volume responses.

Having the ability to filter (on the API side) would actually be a win-win. Do you think Cloudflare would be willing to add that in the future? With the ability to filter, we would only need to make a total of 3 API calls (because of the paging requirement), but without being able to filter, on top of only being able to get 50 back at a time, we would have to make about 370 API calls.

0 Likes

#4

Cant tell I am afraid, but even if, I wouldnt count on it being made available all that quickly.

I understand your arguments and agree that more filters might be a good idea.

Tagging @cloonan and @cscharff

2 Likes