Hi, I am trying to use the CMX 10.2 API to be able to show all clients location by floor.
I am hitting an issue trying to specify a floor/map hierarchy within the Location Active Clients API.
Does the API support this request? If yes, what format does the API require?
Use the mapHierarchy as a query condition string containing campus>building>floor as in this example:
Hi, I'm trying to get the response for this query example you just gave, but ,instead of filtering by the mapHierarchy params, i am getting all the clients information. For now, the result is being the same as if the query does not have any params.
Is there any information that I misunderstood?
The API location clients changed from MSE 8.0 and ignores mapHierarchy as a parameter.
There are new APIs that will return Compact History and Unique MAC Address Seen on a Given Day (or filter time, distance query) on a Floor or Zone.
See the /api/location/v1/history/uniqueclientsbyhierarchy. Use floorid (found by /api/config/v1/maps), since I haven't had luck using uniqueclientsbyhierarchy with the hierarchy string such as DevNetCampus/DevNetBuilding/DevNetZone or DevNetCampus>DevNetBuilding>DevNetZone.
"Unique Clients by date, floorId": "2016/07/06 ,723413320329068590",
"macaddresses ": [
This may be a bug - cannot use hierarchy instead of floorid or zoneid
"Unable to retrieve floorid for hierarchy ": "CiscoCampus/Building 9/IDEAS!"
"Unable to retrieve floorid for hierarchy ": "DevNetCampus/DevNetBuilding/DevNetZone"
Hope that helps,
Since the hierarchy internal sort/filter of the API is not supported in CMX 10.2.2, an alternative is to GET: All clients, and then sort offline by floorid, zoneid, or hierarchy.
Using history api above with a small time window will still only gives you the MAC Addresses, and then would have to query for location per wireless client afterward.
Hope this gives you some options,
Hi, Matt, thank you for the answer before, it really gave me some options. I have been testing the query like these examples:
/api/location/v1/history/clients?hierarchy=xxx/yyy/zzz - getting "Unexpected 'P'"
/api/location/v1/history/uniqueclientsbyhierarchy?floorid=xxx - getting "Resource Not Found"
I'm also trying this one: /api/location/v2/clients?sortby=floorid:xxxx
but the same problem seems to be happening, i'm getting all clients information, not sorting by floorId.
In CMX 10.2 API Documentation, it says "Supported values for sortBy param are 'lastLocatedTime', 'userName', 'macAddress', 'ssId' and 'dot11Status'".
Do you know any other way to sort that would be helpful?
Some of these REST APIs changed or are new for CMX 10.2.2-340, so be sure to upgrade.
I see that getting specific clients /api/location/clients support search by ip address, mac address, and username. I've tried successfully by ip and mac.
Regarding getting all clients /api/location/clients and then sortBy parameters, none of the supported values will help with locating by floor or zone. Therefore, you would need to get all clients then sort/filter by floorRefId or mapHierarchyString, which could include a fourth element of zone, e.g. campus-name, building-name, floor-name, zone-name.
If you are looking for real-time response for clients entering a floor or zone, look at the notifications under configuration api.
I am also trying to get the client data for a specific zone. I have tried getting all the client data using api/location/v2/clients/ but only get most of the clients. If i look on our wireless controllers there are about 10000 clients, but the api call only retrieves 6000. I have checked that all controllers are added to the CMX and responding to NMSP.
Is there any reason I dont see more clients?
This may be a page size limitation. Try using smaller page sizes and increment the page for multiple GET requests.
Thanks for that suggestion. Oddly when I do the pageSize=1000 I get 2000 clients data. What does the 1000 represent?
One more question, where do I find API userguide for CMX10.2? This link seems to be outdated and says default page size is 5000 which no longer seems to be correct.
The REST API Guide for 10.2 has been added to DevNet CMX Mobility Services page, https://developer.cisco.com/site/cmx-mobility-services/documents/cmx-10.2-api-reference/index.gsp
Hopefully, they will publish the pdf version of Cisco Connected Mobile Experiences REST API Guide, Release 10.2 under the Programming Guides, soon.
Regarding the double expected results, 2000 instead of 1000, the defect is fixed in 10.2.3.
CSCux07724 Client location V2 API returns double the number of expected results
HTTP GET /api/location/v2/clients?page=1&pageSize=1 returns double the number of records than that of the expected. i.e. if pageSize=2, it returns 4 records, if pageSize=3, it returns 6 records, and so on.
This behaviour is observed when API is invoked with query parameters using REST Client or a Java Utility.
for e.g HTTP GET /api/location/v2/clients?page=1&pageSize=1 returns double the number of records than that of the expected. i.e. if pageSize=2, it returns 4 records, if pageSize=3, it returns 6 records, and so on.