list the device in a network - only model=MR45

Solved
RobHuijser
Getting noticed

list the device in a network - only model=MR45

(I am using postman for this case)

 

When I execute baseUrl/networks/HP_NetworkID/devices the whole device-list in the network is returned. So switches, SDWAN and access points, etc.

 

Question: Can I set (and how) a output filter in Postman to return only access points (like MR45)?

 

Rob

 

1 Accepted Solution
CN
Meraki Alumni (Retired)
Meraki Alumni (Retired)

Preface: This method is only going to get a list of all the devices, not really meant for using those results again in Postman. 

 

Using Postman v1 with JSON Magic | JSON to CSV and Tables automatically you can easily filter results using the visualize tab. This comes standard in the latest Postman collection

 

With your existing devices API call, in the JSONata Expression you can do something like below to do a search. 

 

 

$[model='MR45']

 

 

To further refine the output of the results you can choose which columns get output. 

 

 

$[model='MR45']. 
{
    "model":model,
    "name":name,
    "serial":serial
}

 

 

 

Another approach would be to query inventoryDevices and use the search parameter included in the query. This would output ALL of the MR45s in the organization. The advantage of using this search is that it doesn't have to be an exact match. Searching for MR4 would return MR42, MR45, MR46, etc. Depending on how you decide to consume that data you could download it all as a csv.

 

 

{{baseUrl}}/organizations/:organizationId/inventoryDevices?search=MR45

 

 

 

Or more JSONata expressions can be used to further search / refine the data. This will filter for the specified networkId, and then build a new JSON array that only contains the columns you're interested in. 

 

 

$[networkId='L_6625111111'].
{
    "name":name,
    "serial":serial,
    "mac":mac
}

 

 

 

Query refinement using predicate expressions · JSONata has a lot more details of different search syntax. 

View solution in original post

1 Reply 1
CN
Meraki Alumni (Retired)
Meraki Alumni (Retired)

Preface: This method is only going to get a list of all the devices, not really meant for using those results again in Postman. 

 

Using Postman v1 with JSON Magic | JSON to CSV and Tables automatically you can easily filter results using the visualize tab. This comes standard in the latest Postman collection

 

With your existing devices API call, in the JSONata Expression you can do something like below to do a search. 

 

 

$[model='MR45']

 

 

To further refine the output of the results you can choose which columns get output. 

 

 

$[model='MR45']. 
{
    "model":model,
    "name":name,
    "serial":serial
}

 

 

 

Another approach would be to query inventoryDevices and use the search parameter included in the query. This would output ALL of the MR45s in the organization. The advantage of using this search is that it doesn't have to be an exact match. Searching for MR4 would return MR42, MR45, MR46, etc. Depending on how you decide to consume that data you could download it all as a csv.

 

 

{{baseUrl}}/organizations/:organizationId/inventoryDevices?search=MR45

 

 

 

Or more JSONata expressions can be used to further search / refine the data. This will filter for the specified networkId, and then build a new JSON array that only contains the columns you're interested in. 

 

 

$[networkId='L_6625111111'].
{
    "name":name,
    "serial":serial,
    "mac":mac
}

 

 

 

Query refinement using predicate expressions · JSONata has a lot more details of different search syntax. 

Get notified when there are additional replies to this discussion.