AnsweredAssumed Answered

ACS 5.5 RESTful Query

Question asked by cspeck1973 on Jan 31, 2015
Latest reply on Apr 6, 2015 by Valeriy Simonov

Trying to make a restful query to pull down all the Locations configured.

 

Here is a quick shot of some locations as seen through ...Rest/NetworkDevice/DeviceGroup

Screen Shot 2015-01-30 at 6.43.09 PM.png

 

The setup....

 

STEP 1

target url:"https://myACSServer/Rest/NetworkDevice/DeviceGroup/op/query"

requestType: PUT

Content-Type: "application/xml"

 

Payload (v1):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns2:query xmlns:ns2="query.rest.mgmt.acs.nm.cisco.com">

<criteria xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:SimpleFilter">

groupType

EQUALS

Location

100

1

</criteria>

</ns2:query>

 

v1 yields this error message:

"SimpleFilter is not allowed for Device Group Search. Use AndFilter, in which one filter should be with name as property, STARTS_WITH as operation, and value as name of the top level group. Example: To search all the groups under the top level group Location, the first filter should be: property is name, STARTS_WITH as operation and Location as value."

 

That Seems like a very good error message... So I updated my payload

Payload (v2):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns2:query xmlns:ns2="query.rest.mgmt.acs.nm.cisco.com">

<criteria xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:AndFilter">

<simpleFilters>

<propertyName>name</propertyName>

<operation>STARTS_WITH</operation>

<value>All Location</value>

</simpleFilters>

<simpleFilters>

<propertyName>name</propertyName>

<operation>CONTAINS</operation>

<value>A</value>

</simpleFilters>

</criteria>

<numberOfItemsInPage>100</numberOfItemsInPage>

<startPageNumber>1</startPageNumber>

</ns2:query>

 

Payload V2 resulted in the following:

<ns2:restResult>

<errorCode>61013</errorCode>

<httpCode>400</httpCode>

<moreErrInfo>Query page number should be no less than 1.</moreErrInfo>

<operationType>SEARCH_BY_QUERY</operationType>

<resourceType>DeviceGroup</resourceType>

<status>BAD_REQUEST</status>

</ns2:restResult>

 

I am unsure how to proceed.... Any suggestions?

Outcomes