cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1098
Views
0
Helpful
2
Replies

Cisco Prime Infrastructure 2.2 API IP-Filter possible, Mac-Filter not possible

trantuanthien
Level 1
Level 1

 

I am trying to read out ClientDetails Info from Rest API

 

The Command

curl -k  -u rest_api:PWD "https://ciscoprime/webacs/api/v1/data/ClientDetails"

 

returns

 

<?xml version="1.0" ?><queryResponse type="ClientDetails" rootUrl="https://ciscoprime/webacs/api/v1/data" requestUrl="https://ciscoprime/webacs/api/v1/data/ClientDetails" responseType="listEntityIds" count="5272" first="0" last="99">

<entityId url="https://ciscoprime/webacs/api/v1/data/ClientDetails/2532541" type="ClientDetails">2532541</entityId>

<entityId url="https://ciscoprime/webacs/api/v1/data/ClientDetails/2532544" type="ClientDetails">2532544</entityId>

…..

url="https://ciscoprime/webacs/api/v1/data/ClientDetails/2533250" type="ClientDetails">2533250</entityId></queryResponse>

 

which is correct

 

When I Filter for a Certain IP Address:

 

 

curl -k  -u rest_api: PWD  "https://ciscoprime/webacs/api/v1/data/ClientDetails?ipAddress=xxx.xxx.xxx.xxx" > test.txt

 

Returns

 

<?xml version="1.0" ?><queryResponse type="ClientDetails" rootUrl="https://ciscoprime/webacs/api/v1/data" requestUrl="https://ciscoprime/webacs/api/v1/data/ClientDetails?ipAddress=xxx.xxx.xxx.xxx" responseType="listEntityIds" count="1" first="0" last="0">

<entityId url="https://ciscoprime/webacs/api/v1/data/ClientDetails/369910606" type="ClientDetails">369910606</entityId></queryResponse>

 

 

Same Filterstructure for macAddress does not work.

I have tried several escape chars  - putting it in quotation marks etc.

 

curl -k  -u rest_api:PWD "https://ciscoprime/webacs/api/v1/data/ClientDetails?macAddress=xx:xx:xx:xx:xx:xx" > test.txt

 

<?xml version="1.0" ?><errorDocument><httpResponseCode>400</httpResponseCode><httpMethod>GET</httpMethod><message>Bad or missing filter property value [xx:xx:xx:xx:xx:xx] for property [macAddress] on entity [ClientDetails].-PRS-113</message><id>presentation.PRS-113</id><uriPath>data/ClientDetails</uriPath><queryParams>{macAddress=[ xx:xx:xx:xx:xx:xx]}</queryParams></errorDocument>

 

 

2 Replies 2

Spencer Zier
Cisco Employee
Cisco Employee

Wrap the macAddress value in double quotes:

https://ciscoprime/webacs/api/v1/data/ClientDetails?macAddress="xx:xx:xx:xx:xx:xx"

 

Sorry for the late reply, but the API team usually doesn't check the support forums.  Reach out to us on DevNet instead, we're much more active there: https://developer.cisco.com/site/prime-infrastructure/

hjacubetz68
Level 1
Level 1

On Linux shell for mac address filters try these commands:

curl -k -u username:password "https://<ip oder host pi-server>/webacs/api/v2/data/ClientDetails?macAddress=\"10:60:4b:73:a6:52\"&.full=true"

or

 

curl -k -u username:password "https://<ip oder host pi-server>/webacs/api/v2/data/ClientDetails?macAddress=%2210:60:4b:73:a6:52%22&.full=true"

It works good for me (CentOS7) and I think it will also work with ip address filters ....

Best Regards,

Herbert

Review Cisco Networking for a $25 gift card