08-31-2017 01:49 PM - last edited on 03-25-2019 03:10 PM by ciscomoderator
I am testing MSE (version 8.0.130.0) REST API for client tracking.
I can get JSON objects back with "/api/contextaware/v1/location/clients", but have not found out how to track a single client at a time.
The documentation says that it is doable but never says how. I have copy-and-pasted the entirety of the API documentation below.
Does anyone have any insights? I've seen my own username in the bulk return. I've tried different ways to specify my username in the API call but all either failed with 404, or I just get the giant list.
Big thanks in advance!
----
The location clients object returns the current location of the wireless client for the specified device ID. The ID can be MAC address, IP address, or Username.
HTTP Method
GET
Accepts
Parameters
Response Types
Return Codes
Solved! Go to Solution.
09-01-2017 06:41 AM
OK, don't specify the parameter:
/api/contextaware/v1/location/clients/<username>
09-01-2017 01:10 AM
I've not used the MSE REST API, but I reckon try the following, replacing <username> with your own:
/api/contextaware/v1/location/clients?id=<username>
cheers,
Seb.
09-01-2017 06:15 AM
I've tried that. It gives me a dump of all client location objects.
09-01-2017 06:41 AM
OK, don't specify the parameter:
/api/contextaware/v1/location/clients/<username>
09-01-2017 07:48 AM - edited 09-01-2017 07:52 AM
I've done that also:
2017-09-01 10:46:31 ERROR 404: Not Found.
I have tried many combinations of things.
Basically, if I do anything like "/?key=value" (as you normally see in a HTTP GET URL with parameters), I get the entire dump. If I don't use the "?" sign, I get 404.
09-01-2017 08:58 AM
The example column:
https://64.103.26.61:443/api/contextaware/v1/location/clients/00:00:2a:01:00:09
...shows the query without a '?', just the value.
Certainly on the APIC-EM API which I have to hand, the following works (which has the same syntax):
/api/v1/network-device/80e5c0e8-cc82-46a3-b5d0-481c56766e29
Sounds like a bug to me.
Does using a MAC address like the Devnet example give a positive result?
cheers,
Seb.
09-01-2017 09:26 AM - edited 09-01-2017 09:27 AM
I take my earlier response back.
/api/contextaware/v1/location/clients/<username> /api/contextaware/v1/location/clients/<macaddress>
Both of those actually work. Not sure what happened in my earlier tests exactly, altough I only tried my own username -- I should have tried more than that, probably -- Also, my record today has the machine's hostname in the "userName" field. Maybe that's what threw me off.
Thank you for the support!
By the way, I also did find some sample Python code in Github.
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