cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1504
Views
4
Helpful
14
Replies
Highlighted

CMX 10.2 Location API Clinets per Floor?

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?

Thank you!

14 REPLIES 14
Highlighted
Frequent Contributor

Re: CMX 10.2 Location API Clinets per Floor?

Hi,

Use the mapHierarchy as a query condition string containing campus>building>floor as in this example:

https://msesandbox.cisco.com:8081/api/location/v2/clients?mapHierarchy=DevNetCampus>DevNetBuildng>DevNetZone

Matt

Highlighted
Beginner

Re: CMX 10.2 Location API Clinets per Floor?

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?

Highlighted
Frequent Contributor

Re: CMX 10.2 Location API Clinets per Floor?

Hi, 

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.

https://msesandbox.cisco.com:8081/api/location/v1/history/uniqueclientsbyhierarchy?date=2016/07/06&floorid=7234133203290…

{

  "Unique Clients by date, floorId": "2016/07/06 ,723413320329068590",

  "Count": 69,

  "macaddresses ": [

    "00:00:2a:01:00:23",

    "00:00:2a:01:00:22",

    "00:00:2a:01:00:25",

...


This may be a bug - cannot use hierarchy instead of floorid or zoneid

CiscoCampus/Building 9/IDEAS!

723413320329068650

https://msesandbox.cisco.com:8081/api/location/v1/history/uniqueclientsbyhierarchy?hierarchy=CiscoCampus/Building%209/IDEAS!&date=2016/07/06

{

"Unable to retrieve floorid for hierarchy ": "CiscoCampus/Building 9/IDEAS!"

}

DevNetCampus/DevNetBuilding/DevNetZone

723413320329068590

https://msesandbox.cisco.com:8081/api/location/v1/history/uniqueclientsbyhierarchy?hierarchy=DevNetCampus/DevNetBuilding/DevNetZone&date=2016/07/06

{

"Unable to retrieve floorid for hierarchy ": "DevNetCampus/DevNetBuilding/DevNetZone"

}


Hope that helps,

Matt

Highlighted
Frequent Contributor

Re: CMX 10.2 Location API Clinets per Floor?

Hi,

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,

Matt

Highlighted
Beginner

Re: CMX 10.2 Location API Clinets per Floor?

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?

Thank you!

Highlighted
Frequent Contributor

Re: CMX 10.2 Location API Clinets per Floor?

Hi,

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.

Matt

Highlighted
Beginner

Re: CMX 10.2 Location API Clinets per Floor?

Hi,

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?

Thanks,

Peter.

Highlighted
Frequent Contributor

Re: CMX 10.2 Location API Clinets per Floor?

Hi Peter,

This may be a page size limitation.  Try using smaller page sizes and increment the page for multiple GET requests. 

api/location/v2/clients?page=1&pageSize=1000

Matt

Highlighted
Beginner

Re: CMX 10.2 Location API Clinets per Floor?

Hi Matt,

Thanks for that suggestion. Oddly when I do the pageSize=1000 I get 2000 clients data. What does the 1000 represent?

Thanks,

Peter.

Highlighted
Beginner

Re: CMX 10.2 Location API Clinets per Floor?

Hi Matt,

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.

https://developer.cisco.com/site/cmx-mobility-services/documents/api-reference-manual/#query-conditions

Thanks,

Peter.

Highlighted
Frequent Contributor

Re: CMX 10.2 Location API Clinets per Floor?

Hi Peter,

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.

Cisco Mobility Services Engine - Programming Guides - Cisco

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.

Matt

Highlighted
Beginner

Re: CMX 10.2 Location API Clinets per Floor?

Hi, to get the clients for a specific floor, I'm using the api/location/v1/clients?floorRefId=xxx.

Hope it helps 

Rodrigo.

Highlighted
Beginner

Re: CMX 10.2 Location API Clinets per Floor?

Hi Rodrigo,

I am quite new to this. How do I get a listing of floorids?

Thanks,

Peter.

Highlighted
Frequent Contributor

Re: CMX 10.2 Location API Clinets per Floor?

Hi, The floorid is found by /api/config/v1/maps REST API.  Matt

CreatePlease to create content
Content for Community-Ad
Cisco Community April 2020 Spotlight Award Winners
This widget could not be displayed.