Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

API & Integration, DevOps,NetOps,SecOps

Reply

/allrecords endpoint search subset of types

New Member
Posts: 1
1734     0

Hi,

 

I would like to use the wapi to retrieve a subset of records through the /allrecords endpoint by making use of the type parameter and selecting a few record type, does anyone know if that is possible? What I would like to do is for example; set the parameter type to contain the types 'record:a,record:cname,record:txt' so I only get those records in my result.

 

Thanks in advance!

Re: /allrecords endpoint search subset of types

Adviser
Posts: 181
1735     0

Hi,

 

You can acheive this using the /request object which supports collating multiple API calls into one WAPI like below.

 

curl -k -u admin:Infoblox -H 'content-type:application/json' -X POST "https://127.0.0.1/wapi/v2.10/request" -d '[{"method":"GET","object":"record:a","data":{},"args":{}},{"method": "GET","object": "record:cname","data": {},"args": {}},{"method": "GET","object": "record:txt","data": {},"args": {}}]'

This returns a list of A/CNAME/TXT records like below:

[
    [
        {
            "_ref": "record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmxhYi1zZXR1cCxncmlkLW1hc3RlciwxNzIuMjYuMS4y:grid-master.lab-setup.com/default",
            "ipv4addr": "172.26.1.2",
            "name": "grid-master.lab-setup.com",
            "view": "default"
        },
        {
            "_ref": "record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQuY29tLmRlbW8sYSwxOTIuMTY4LjExLjI:a.demo.com/default",
            "ipv4addr": "192.168.11.2",
            "name": "a.demo.com",
            "view": "default"
        },
        {
            "_ref": "record:a/ZG5zLmJpbmRfYSQuMS5jb20uZGVtbyxhLDE5Mi4xNjguMTEuMg:a.demo.com/ansible-test",
            "ipv4addr": "192.168.11.2",
            "name": "a.demo.com",
            "view": "ansible-test"
        },
        {
            "_ref": "record:a/ZG5zLmJpbmRfYSQuMS5jb20uZGVtbyxhYiwxOTIuMTY4LjExLjI:ab.demo.com/ansible-test",
            "ipv4addr": "192.168.11.2",
            "name": "ab.demo.com",
            "view": "ansible-test"
        }
    ],
    [
        {
            "_ref": "record:cname/ZG5zLmJpbmRfY25hbWUkLl9kZWZhdWx0LmNvbS5kZW1vLnd3dw:www.demo.com/default",
            "canonical": "demo.com",
            "name": "www.demo.com",
            "view": "default"
        }
    ],
    [
        {
            "_ref": "record:txt/ZG5zLmJpbmRfdHh0JC5fZGVmYXVsdC5jb20uYWJjLnRlc3QtdGV4dC4iVGhpcyIgImlzIiAiYSIgInRlc3Qi:test-text.abc.com/default",
            "name": "test-text.abc.com",
            "text": "This is a test",
            "view": "default"
        }
    ]
]

Thanks and Regards,

Krishna Vasudevan

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You