Not getting expected results via Postman or Meraki Tools??

Rusalka
Here to help

Not getting expected results via Postman or Meraki Tools??

I am trying to created a Postman collection to return only Networks that are:

1. not bound to a template

2. includes the appliance type:  wireless  (regardless, of just wireless or combined with other appliance types)

 

I am using this url string:  {{baseUrl}}/organizations/:organizationId/networks?productTypes[]=wireless&isBoundToConfigTemplate=false

 

But the results are including Networks that are "appliance" only as well.  Is it because I'm mixing an array and text in the query??

 

I have tested with the Meraki Tools for G-sheets and getting same results.

 

I guess I could try making a python script to do this but then that limits it to just me running the script since my team does not have the ability to do so.

7 Replies 7
RaphaelL
Kind of a big deal
Kind of a big deal

Those unexpected results , are they only appliance or they are combined ? ( 'appliance,'switch','wireless' ) ?

 

I'm testing the filter and 'wireless' will return me combined network AND wireless-only networks.  😕 

only 'appliance'.

 

To be clear, we have a wide combination of Networks, both appliance, camera, switch, wireless or combination. 

 

So any combination that includes 'wireless' is an acceptable response.  But, I'm also getting responses that are only 'appliance' which does not meet the search parameters.

Ryan_Miles
Meraki Employee
Meraki Employee

In Postman when I send this array I only get networks that include wireless. I'm not seeing it return any networks that are MX, MS, MV, etc only or even combined networks that don't include a -wireless network type.

 

{
"productTypes": ["wireless"]
}

@Ryan_Miles 

Interesting, unfortunately, not working for me.  I even tried putting wireless in quotes in the query string, still received the same results.  What version of the API are you running?  I'm using v1.36.0.

 

And as I previously mentioned, I get the same results from Postman and Meraki Tools.

 

cc @DexterLaBora 

1.36

 

To be exact my url string is {{baseUrl}}/organizations/:organizationId/networks?isBoundToConfigTemplate=false

 

Then on the raw tab I have that array snippet (type JSON)

 

{
"productTypes": ["sensor"]
}
Badr-eddine
Getting noticed

Hi, try this JavaScript test script in Postman:

 

// Test if the response status code is 200
pm.test("Response status code is 200", function () {
    pm.response.to.have.status(200);
});

// Test and filter the response based on product type and isBoundToConfigTemplate
pm.test("Filters the JSON response data to find networks with the 'wireless' product type that are not bound to a configuration template", function () {
    // Parse the JSON response data
    var jsonData = pm.response.json();
    
    // Filter the array of networks based on specified conditions
    var filteredNetworks = jsonData.filter(function (network) {
        return network.productTypes.includes('wireless') && network.isBoundToConfigTemplate === false;
    });
    
    // Assert that the filteredNetworks array is not empty
    pm.expect(filteredNetworks).to.be.an('array').and.not.empty;
    
    // Store the filteredNetworks array in the environment as a JSON string
    pm.environment.set('filteredNetworks', JSON.stringify(filteredNetworks));
});

 

This Postman test script validates an API response:


1. It checks if the response status code is 200.
2. It filters the JSON response data to find networks with the 'wireless' product type that are not bound to a configuration template.
3. The filtered network array is asserted to be non-empty, and the result is stored in the environment as a JSON string for further use.

 

Make sure that you have created an environment in Postman.

 

Feel free to ask!

Thanks @Badr-eddine, the filteredNetworks actually works and has the correct data after I fixed our environment.  One of my team members had set it to v0 as a work around to another issue we are fighting with the newer API versions (mentioned in another post).  Anyway, with it set to v0 it failed but works when I set it back to v1.

 

Really wish we can get this figured out without having to use the "test" to filter it further, otherwise I will be the only one to run this report for the team.  Plus as I mentioned earlier, it also affects Meraki Tools as well.

Get notified when there are additional replies to this discussion.