08-13-2015 02:43 AM
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>
09-01-2015 02:56 PM
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/
05-04-2016 01:46 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide