cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
383
Views
10
Helpful
6
Replies
Contributor

Help filtering out based on data/Devices manufacturerPartNr list

I'm trying to gather a list of devices using the data/Devices call, and filtering based on manufacturerPartNrs->manufacturerPartNr(list).    The deviceType is unreliable in the sense that a WS-C2960C-8PC-L and a WS-C2960X-48FPS-L are "Cisco Catalyst 29xx Stack-able Ethernet Switch" but they are two completely different architectures and I need to treat them differently.

I guess i'm not reading the filtering docs right, but I believe I should be able to use something like:

https://prime/webacs/api/v1/data/Devices.json?.full=true&.sort=deviceName&manufacturerPartNrs.manufacturerPartNrs.elements=WS-C2960X-48FPS-L

or

https://prime/webacs/api/v1/data/Devices.json?.full=true&.sort=deviceName&manufacturerPartNrs.manufacturerPartNrs.indices=WS-C2960X-48FPS-L


However, any iteration i've tried returns the same thing as if i ran:

https://prime/webacs/api/v1/data/Devices.json?.full=true&.sort=deviceName


Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Help filtering out based on data/Devices manufacturerPartNr list

As an array, manufacturerPartNrs is not filterable.  Our apologies, as this isn't called out anywhere in the documentation (we'll address that).  To address your use case, please try the following query using our InventoryDetails resource:

/webacs/api/v1/data/InventoryDetails?.full=true&.sort=summary.deviceName&udiDetail.modelNr="WS-C2960X-48FPS-L"

EDIT: Nevermind, we do in fact support filtering here.  It's not a feature that often gets used (because we don't have many collections of primitives in filterable resources) so I'd totally forgotten about it .  Our filtering page covers this in the "Filtering on collections of primitives" section.

So you can either use the above query, which I believe satisfies your use case, or use the following:

/webacs/api/v1/data/Devices?.full=true&.sort=deviceName&manufacturerPartNr.elements="WS-C2960X-48FPS-L"

6 REPLIES 6
Beginner

Re: Help filtering out based on data/Devices manufacturerPartNr list

Just a guess here, can you try "manufacturerPartNrs.manufacturerPartNr" instead of "manufacturerPartNrs.manufacturerPartNrs"

You can also try manufacturerPartNrs.manufacturerPartNr="WS-C2960X-48FPS-L"


Contributor

Re: Help filtering out based on data/Devices manufacturerPartNr list

Apologies, cut and paste error.  That is what I meant - manufacturerPartNrs.manufacturerPartNr  In all honesty i've tried all combinations.


I've also tried other filter options like:
https://prime/webacs/api/v1/data/Devices.json?.full=true&.sort=deviceName&manufacturerPartNrs.manufacturerPartNr=contains("C2960X")


with the same result - full list of devices.

Cisco Employee

Re: Help filtering out based on data/Devices manufacturerPartNr list

As an array, manufacturerPartNrs is not filterable.  Our apologies, as this isn't called out anywhere in the documentation (we'll address that).  To address your use case, please try the following query using our InventoryDetails resource:

/webacs/api/v1/data/InventoryDetails?.full=true&.sort=summary.deviceName&udiDetail.modelNr="WS-C2960X-48FPS-L"

EDIT: Nevermind, we do in fact support filtering here.  It's not a feature that often gets used (because we don't have many collections of primitives in filterable resources) so I'd totally forgotten about it .  Our filtering page covers this in the "Filtering on collections of primitives" section.

So you can either use the above query, which I believe satisfies your use case, or use the following:

/webacs/api/v1/data/Devices?.full=true&.sort=deviceName&manufacturerPartNr.elements="WS-C2960X-48FPS-L"

Contributor

Re: Help filtering out based on data/Devices manufacturerPartNr list

Thanks, that worked!

I guess I just misunderstood the docs, I was going by using the "dotted notation" under Filtering Syntax section for  a nested parameter. Since it is an element in a collection, it isn't nested - is that correct?

Cisco Employee

Re: Help filtering out based on data/Devices manufacturerPartNr list

It isn't needed in this case, correct.

To get into the weeds a little bit, because the presentation that we do here (<manufacturerPartNrs><manuFacturerPartNr>) doesn't represent the actual structure of the data, it's just a cosmetic way for us to take the array of Strings and display and marshal them into XML.  The actual filtering that needs to happen is against elements parameter of the array itself (hence, the filter parameter is manufacturerPartNr.elements).  When we do dotted notation against other collections, what you see in the XML represents the actual structure of our data; for example, in the InventoryDetails query above, summary is a reference to a separate object, so using the dotted notation lets the filtering logic know that it needs to apply that filter to the other object, rather than to the root InventoryDetails object.  I'm not sure if you wanted these details, but that's why there's this difference here.

My apologies for the confusion.  Thank you for reaching out

Highlighted
Contributor

Re: Help filtering out based on data/Devices manufacturerPartNr list

That's exactly the detail i was looking for. Thanks!

Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.