Reply

WAPI: How can I list objects under a smart folder?

New Member
Posts: 1
2071     0

I can list all smartfolder using this

 
Then I tried the below URL, but it given as error about ""AdmConProtoError: Operation \"read by reference\" not allowed for smartfolder:children"
 
 

Re: WAPI: How can I list objects under a smart folder?

Moderator
Moderator
Posts: 318
2071     0

You will need to traverse the children of either a specific personal smart folder or a specific global smart folder.

If it is a "grouped by" smart folder, the first set of results will be the grouping children, and you will need to traverse those results to get the grandchild results, iterated through each level.

First get the smart folder you're looking for:  (escaping the spaces)

curl -k -u admin:infoblox -X GET 'https://gm.example.com/wapi/v2.12/smartfolder:personal?name=Networks%20by%20Type'


returns:

[
    {
        "_ref": "smartfolder:personal/Li5teV9wZXJzb25hbF9zbWFydF9mb2xkZXIkb25lLnBlcnNvbmFsX3NtYXJ0X2ZvbGRlciQuY29tLmluZm9ibG94Lm9uZS5hZG1pbiRhZG1pbi5OZXR3b3JrcyBieSBUeXBl:Networks%20by%20Type/false", 
        "is_shortcut": false, 
        "name": "Networks by Type"
    }
]


Now ask for the children of one of those smart folder children:

curl -k -u admin:infoblox -X GET 'https://gm.example.com/wapi/v2.12/smartfolder:children?smart_folder=smartfolder:personal/Li5teV9wZXJzb25hbF9zbWFydF9mb2xkZXIkb25lLnBlcnNvbmFsX3NtYXJ0X2ZvbGRlciQuY29tLmluZm9ibG94Lm9uZS5hZG1pbiRhZG1pbi5OZXR3b3JrcyBieSBUeXBl:Networks%20by%20Type/false&_return_fields%2b=value'

which returns two values in this lab grid:  ("Management" and "Data Center")

[
    {
        "_ref": "smartfolder:children/Li5zbWFydF9mb2xkZXJfY2hpbGRyZW4kRGF0YSBDZW50ZXIJLi5teV9wZXJzb25hbF9zbWFydF9mb2xkZXIkb25lLnBlcnNvbmFsX3NtYXJ0X2ZvbGRlciQuY29tLmluZm9ibG94Lm9uZS5hZG1pbiRhZG1pbi5OZXR3b3JrcyBieSBUeXBl:children", 
        "value": {
            "value_string": "Data Center"
        }, 
        "value_type": "ENUM"
    }, 
    {
        "_ref": "smartfolder:children/Li5zbWFydF9mb2xkZXJfY2hpbGRyZW4kTWFuYWdlbWVudAkuLm15X3BlcnNvbmFsX3NtYXJ0X2ZvbGRlciRvbmUucGVyc29uYWxfc21hcnRfZm9sZGVyJC5jb20uaW5mb2Jsb3gub25lLmFkbWluJGFkbWluLk5ldHdvcmtzIGJ5IFR5cGU:children", 
        "value": {
            "value_string": "Management"
        }, 
        "value_type": "ENUM"
    }
]


Now ask for the children within the "Data Center" grouping:

curl -k -u admin:infoblox -X GET 'https://gm.example.com/wapi/v2.12/smartfolder:children?smart_folder=smartfolder:children/Li5zbWFydF9mb2xkZXJfY2hpbGRyZW4kRGF0YSBDZW50ZXIJLi5teV9wZXJzb25hbF9zbWFydF9mb2xkZXIkb25lLnBlcnNvbmFsX3NtYXJ0X2ZvbGRlciQuY29tLmluZm9ibG94Lm9uZS5hZG1pbiRhZG1pbi5OZXR3b3JrcyBieSBUeXBl:children' 


which returns a sinble result in this lab:

[
    {
        "_ref": "smartfolder:children/Li5zbWFydF9mb2xkZXJfY2hpbGRyZW4kMQ:children", 
        "resource": "network/ZG5zLm5ldHdvcmskMTAuOS4xNi4wLzI0LzA:192.168.4.0/24/default", 
        "value": {
            "value_string": "192.168.4.0/24"
        }, 
        "value_type": "STRING"
    }
]



And so on...

Showing results for 
Search instead for 
Did you mean: 

Recommended for You