cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2511
Views
0
Helpful
26
Replies
Highlighted
Beginner

Detailed MSE attribute output documentation

I've found documentation regarding queries and parameters - for example the API Guide. Having difficulty in finding detailed attribute descriptions for the output. In my particular case I am getting all historical information for a given day and want to point an end user to the documentation to decide what they are going to want for their analysis. Still looking, but thought someone might save me time.

For example in the api location history record how to differentiate between the different mac addresses: macaddress and apmacaddress. Which would be the router and which would be the wireless device connecting. Analyzing the object structure in the Object Schema Details section of the API Guide usually gives the answer, but I was hoping for some simple object/attribute lists with detailed descriptions to give to people to decide what they want.

Thanks!!!

26 REPLIES 26
Highlighted
Frequent Contributor

Jon,

I wish there were more information published, also.  There may be some presentations or white papers that go deeper into the API.   I will look for them and share.  Let me know which version of CMX are you using, or both.

Matt

For CMX 10.2

https://developer.cisco.com/media/b_cmx_102_api_reference-ciscotopichtml/index.html

For MSE 8.0

http://www.cisco.com/c/en/us/td/docs/wireless/mse/8-0/MSE_REST_API/Guide/Cisco_MSE_REST_API_Guide.html

Highlighted

The docs networks sent me are for 8.0. At this point I'm not sure they would tell me if they upgraded yet as we have no official dependencies documented yet with them. I was looking at the guide before but as I mentioned above it would take some analysis fo the object structure to determine what is what. Hey thanks for the 102 document. That might help narrow things down a bit as to the volume of information we're currently retrieving. I will pass that along to the project sponsor.

Highlighted

They have moved up to CMX 10.2.2 and moved to new hardware.

Using the new server and credentials they gave me the old RESTful queries when I point to the new server now return a “CMX: System error”

For example a simple query for maps from a browser:

https://credentials:PW@theserver/api/contextaware/v1/maps

returns the CMX System error.


When I run the parallel program that returns lots of history data I merely get 404 errors.

Highlighted
Frequent Contributor

Hi Jon,

The API changed completely from 8 to 10, and I believe CMX engineering purposely skipped an iteration to emphasize the major changes between the earlier and latest CMX systems.  Therefore, the scripts you have been given must be modified for the new API.  There will be a similar CMX 10.2 REST API resource for each of the MSE 8.0 /api/contextaware resources, e.g., the maps resources for CMX 10.2 will be found under Configuration REST API https://msesandbox.cisco.com:8081/apidocs/configuration-api#Map-resources-API

For CMX 10.2.2 you will want to use the API reference found at https://theserver/apidocs and on the DevNet Mobility Services site https://developer.cisco.com/media/b_cmx_102_api_reference-ciscotopichtml/index.html

Good luck with the new hardware and software configuration.  Let us know how we can help further.

Matt.

Highlighted

Not looking good initially. Played with the apidocs functions a bit(they were not available to my creditials before) to make sure I could get results witht he new syntax. Then problems.

You may or may not recall to get any kind of speed of retrieving large amounts of historical client data I had to result to using a parallel program to get 60 seconds of data at a time in 60 parallel queries specifying a one second slice of time. I got what was taking over 12 hours to retrieve down to 1.5 hours.  I was just hoping to change the URI the progam was using and it would work expecting to make some new syntax parameter tweeks. Then in checking into what I have to change I ran into this in the documentation:

With CSCuz69078, when locatedAfterTime and locatedBeforeTime specified in API is more than a day and less than an hour, the API returns the following error.

ERROR - Cassandra timeout during read query at consistency ONE (1 responses were required but only 0 replica responded)

For example, https://<ip-address</api/location/v1/history/clients?locatedAfterTime=1459468800000&locatedBeforeTime=1459636800000 returns the ERROR.

It looks like our whole approach is now going to be blown out of the water.

Suggestions? Comment?

Highlighted
Frequent Contributor

Hi,

I know about the error condition, but testing on the DevNet sandbox the following REST API call returned 67 client history for 4 second time slice.  Any smaller 1-3 sec did not return any records.  So, this API may work for you on 10.2.2.  What is your experience with this?

Matt

/api/location/v1/history/clients?locatedAfterTime=1470636000000&locatedBeforeTime=1470636004000

Highlighted

Got connected and getting data again with the new API. But now puzzled with the

.api/location/v1/history/clients parameters

I have used the following and gotten data:

     https://xxx.xxx.xxx.xx/api/location/v1/history/clients?date=2016/08/09&fromHour=08&toHour=11

However just providing the date to get a 24 hour period returns nothing.

     https://xxx.xxx.xxx.xx/api/location/v1/history/clients?date=2016/08/09


I tried using the fromHour=00 toHour=24 and get an error

00 to 23 works but I wanted to check the entries vs just using the date to make sure that is the correct interval to use to get the whole day's data since given just a date fails to return anything.

The size of the data file seems suspiciously small and runs so much faster compared to what I was getting in the old interface. But maybe this query retrieves fewer fields than the old one did or there is something different in the way the new server/version was configured by our network folks.

Anyway... any reason why just giving a date would not work?

Highlighted
Frequent Contributor

Hi,

The CMX REST API Guide, Release 10.2 has the following:

This would use the passed date as date range from passed date + fromHour to passed date + toHour: /api/location/v1/history/clients?date=2016/03/02 and fromHour=14 and toHour=15.

The CMX 10.2.2 /apidocs has the following:

This would use the passed date as date range from passed date + fromHour to passed date + toHour

/api/location/v1/history/clients?date=2016/03/02&fromHour=14&toHour=15

It appears you must use date + fromHour + toHour, and you must use the &, as in the /apidocs example.  Also, I believe the from/to Hour is 00 to 23, but I don't see how to get the 23 hundred hour data, e.g., https://msesandbox.cisco.com:8081/api/location/v1/history/clients?date=2016/08/11&fromHour=23&toHour=00

returns error 400 Bad Request - Invalid query params, <fromHour> must be less than <toHour>.

and https://msesandbox.cisco.com:8081/api/location/v1/history/clients?date=2016/08/11&fromHour=23&toHour=24

returns error 400 Bad Request - Invalid query params, <toHour> 24 Allowed value is between 00 and 23 (both inclusive)

Also, note that the page size is limited to 5000 and does not support pagination.  Therefore, may need to use epoch milliseconds for less than hour all client history.  Subscription to a notification stream for client location may solve your issue with collecting history data.

Let me check with CMX engineering on usage for date + ...

Matt

Highlighted

Ok, will experiment using that knowledge some more next week and hopefully the engineers will give us more information for a plan of attack.

I will also check out the notification stream possibility.

Again, thanks so much for your help.

Highlighted
Frequent Contributor

Hi, I posted this on the CMX engineering mailer.  They thought it might be a bug, wondering how they missed it, and checking it out.  Matt

From: "Matthew Farrell -X (matfarre - INSIGHT GLOBAL INC at Cisco)" <matfarre@cisco.com>

Date: Tuesday, August 16, 2016 at 6:12 AM

To: "cs-location(mailer list)" <cs-location@cisco.com>

Subject: 2nd Try: Client Location History API parameters date & fromHour & toHour

2nd Try – How do you specify fromHour/toHour for 23:00 – 23:59?

Thanks,

Matt

Highlighted

I am trying to do more testing this week. I am having trouble specifying small time slices with epoch timestamps as well. I have to reset a little as the day I was working with rolled off what they actively keep in networks.

Let me make sure I have this much right though:

Is the locatedAftertime and locatedBeforeTime based on "statistics"=>"firstlocatedTime"?

What I was doing was first getting whatever came back with a api/location/history/clients?date=xx/xx/xx&fromHour=xx&toHour=xx query.

Then I picked an entry and took its "firstlocatedTime" and converted it to GMT and then to Epoch.

Then I would pick a time slice and do a query api/location/history/clients?locatedAftertime=xxxxx&locatedBeforeTime=xxxxx

I picked a time that would be a pretty busy time here. If I specified an epoch interval of 30 seconds or so I would get data. If I narrowed that down to 15 seconds I would get a 500 error. If I picked the right time this query keys off of(firstlocatedTime) it should have returned something.

Unfortunately that data is gone now. But I am going to pick another day and then epoch time slot and try again.

Highlighted
Frequent Contributor

Jon,

Be careful of the query parameter format, I found if left a space between = and timestamp I get a 500 error.  This was the only way I was able to reproduce your error.  I think this may be considered a bug, since spaces should be handled in the parsing of the query.  I will check with the CMX guys.

Matt

Highlighted

Yes, I have noticed a few things here and there like that. I have reset my tests for 8/16 and am getting data with the date and fromHour and toHour but getting nothing but errors now with locatedBeforeTime and locatedAfterTime. Here are some echos and the error: Note the line wrap after "?" is only when pasted here. I get data when I request a date and the hour from 8 to 9. Below I am trying to specify 15 seconds from 8:00:00 to 8:00:15 CDT or 13:00:00 to 13:00:15 GMT There are no spaces in the URI but it thinks I am making a bad request. I'm probably looking at it too long and too hard.

$VAR1 = bless( {

                 '_uri' => bless( do{\(my $o = 'https://xxx.xxx.xxx.xx/api/location/v1/history/clients?locatedAfterTime=1471352400000&locatedBeforeTime=1413533000000')}, 'URI::https' ),

                 '_headers' => bless( {

                                        'accept' => 'application/json',

                                        'authorization' => 'Basic a29jaGVyOmswY2gzciFA',

                                        'user-agent' => 'Chrome',

                                        '::std_case' => {

                                                          'if-ssl-cert-subject' => 'If-SSL-Cert-Subject'

                                                        }

                                      }, 'HTTP::Headers' ),

                 '_content' => '',

                 '_method' => 'GET',

                 '_uri_canonical' => $VAR1->{'_uri'}

               }, 'HTTP::Request' );

$VAR2 = '

';

Problem Fetching Page - Code is: 400

Highlighted
Frequent Contributor

Jon,

No problem, I ran your query from Postman, and got the following

400 Bad Request

Invalid query params, <fromTime> can't be greater than <toTime>.

locatedAfterTime=1471352400000&locatedBeforeTime=1413533000000

1471352400000 Tue Aug 16 2016 13:00:00

1413533000000 Fri Oct 17 2014 08:03:20

Matt

Content for Community-Ad
Cisco Community August2020 Spotlight Award Winners
This widget could not be displayed.