Filter results from Cloudflare get

We currently have 2200+ domains between 26 different Cloudflare sub-accounts. I am trying to use the API to generate a list of the domains on each account. A partial results from the get to list the zones is below. I am trying to find a way to only display a list of the domain names. They show up as domain1.com and domain2.com in the quote.

{
    "result": [
        {
            "id": "redacted",
            "name": "domain1.com",
            "status": "active",
            "paused": false,
            "type": "full",
            "development_mode": 0,
            "name_servers": [
                "duke.ns.cloudflare.com",
                "kiki.ns.cloudflare.com"
            ],
            "original_name_servers": [
                "edns86.ultradns.biz",
                "edns86.ultradns.com",
                "edns86.ultradns.net",
                "edns86.ultradns.org"
            ],
            "original_registrar": null,
            "original_dnshost": null,
            "modified_on": "2020-04-23T22:00:49.037560Z",
            "created_on": "2019-02-19T21:43:27.047459Z",
            "activated_on": "2019-02-19T21:44:43.592633Z",
            "meta": {
                "step": 3,
                "wildcard_proxiable": false,
                "custom_certificate_quota": 0,
                "page_rule_quota": 3,
                "phishing_detected": false,
                "multiple_railguns_allowed": false
            },
            "owner": {
                "id": "redacted",
                "type": "organization",
                "name": "redacted"
            },
            "account": {
                "id": "redacted",
                "name": "redacted"
            },
            "plan": {
                "id": "0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                "name": "Free Website",
                "price": 0,
                "currency": "USD",
                "frequency": "",
                "is_subscribed": true,
                "can_subscribe": false,
                "legacy_id": "free",
                "legacy_discount": false,
                "externally_managed": false
            }
        },
        {
            "id": "redacted",
            "name": "domain2.com",
            "status": "active",
            "paused": false,
            "type": "full",
            "development_mode": 0,
            "name_servers": [
                "duke.ns.cloudflare.com",
                "kiki.ns.cloudflare.com"
            ],
            "original_name_servers": [
                "edns86.ultradns.biz",
                "edns86.ultradns.net",
                "edns86.ultradns.com",
                "edns86.ultradns.org"
            ],
            "original_registrar": null,
            "original_dnshost": null,
            "modified_on": "2020-04-23T22:10:17.129272Z",
            "created_on": "2019-02-19T21:49:37.641903Z",
            "activated_on": "2019-02-19T21:50:56.767119Z",
            "meta": {
                "step": 3,
                "wildcard_proxiable": false,
                "custom_certificate_quota": 0,
                "page_rule_quota": 3,
                "phishing_detected": false,
                "multiple_railguns_allowed": false
            },
            "owner": {
                "id": "redacted",
                "type": "organization",
                "name": "redacted"
            },
            "account": {
                "id": "redacted",
                "name": "redacted"
            },
            "plan": {
                "id": "0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                "name": "Free Website",
                "price": 0,
                "currency": "USD",
                "frequency": "",
                "is_subscribed": true,
                "can_subscribe": false,
                "legacy_id": "free",
                "legacy_discount": false,
                "externally_managed": false
            }
        }
    ],
    "result_info": {
        "page": 1,
        "per_page": 20,
        "total_pages": 106,
        "count": 20,
        "total_count": 2114
    },
    "success": true,
    "errors": [],
    "messages": []
}

Hey @brand,

Welcome to the Postman community! :star:

This is not the ideal solution but I created a template that you can import which would allow you to use the JSONPath syntax to filter down the response. It’s not going to win any style awards but it’s functional :smile:

https://explore.postman.com/templates/4594/visualizer---filter-response-body-data-using-jsonpath

Using the $..result[*].name you should be able the filter the response to show:

1 Like