cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1034
Views
5
Helpful
2
Replies

Bulk GET Question using Postman

ropauljr87
Level 1
Level 1

ISE 1.3

Using Postman,

I have tried using:
GET (ise-admin-url:9060)/ers/config/guestuser
Accept: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml
Content-Type: application/vnd.com.cisco.ise.identity.guestuser.2.0+xml

 

This returns:

<resources>
        <resource name="username" id="long-id-string">
            <link type="application/xml" href="url with long-id-string" rel="self"/>
        </resource>
 
I can use the id="long-id-string" to then do another GET for specific account information.
GET (ise-admin-url:9060)/ers/config/guestuser/"long-id-string"
 
My question: Is there a way to just do one GET to obtain the specific account information for all guest accounts? I am looking to complete this to save guest accounts for auditing information. Doing this for each id would take me a long while...considering I am not savvy enough to script it.
2 Replies 2

Arne Bier
VIP
VIP

@ropauljr87  - it's been a while since I did any REST stuff. But I recall that you can append a ?size=100 (100 is the max apparently) to the REST call, and then it tells the server to return up to that many items in your XML/JSON response. 

 

if you need more than 100 then you have no option but to script it. It's not that scary ...

I will also refer you to this neat little Python procedure that someone posted on this Community forum - I am sure you can hack something together to suit your needs ;-)

 

def get_device_list(s):
    """
    Return list of the Network Devices
    Maximum is 100 devices per page ?size=100
    Go through the pages &page = 1
    """
    url = "https://" + ISE_SERVER + ":9060/ers/config/networkdevice?size=100&page="
    url = url + "1"
     resp= requests.request("GET", url, data=payload, headers=headers, params=querystring)
    
    device_list = []
if resp.status_code == 200:
        result  = resp.json()['SearchResult']
        total = result['total']
        pages = total / 100 + 1
        for page in range (1, int(pages + 1)):
            resp= requests.request("GET", url + str(page), data=payload, headers=headers, params=querystring)
            if resp.ok:
                result = resp.json()['SearchResult']['resources']
                for item in result:
                    device = {}
                    device['id'] = item['id']
                    device['name'] = item['name']
                    """ Not all devices has description field """
                    # device['description'] = item['description']
                    device['link'] = item['link']['href']
                    device_list.append(device)
return device_list


Thank you for your answer Arne.

In Postman, it has some query params for page size, and I can increase that value out to 100. This does increase the number of responses returned, but they are only just username and ID-string. I can then utilize those ID-strings in another GET, but I have only been able to figure out how to get these one at a time. NOTE: this second get returns more specific guest account information.