cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
861
Views
1
Helpful
4
Replies
Highlighted
Beginner

MSE Location API - Paging and IP switching

Hello,

I have the following problem:
1. I request https://22.222.22.222/api/contextaware/v1/location/history/clients?from&to with a few days range
2. Got a response which holds 5000 entries for page 1 of 50 pages
3. The response has "nextResourceURI" that should serve page 2 at - https://11.111.11.111/api/contextaware/v1/location/history/clients?pageNumber=2

4. If I call this URI directly I get 404, if I change the IP only to the old resource ip (22.222.22.222) it works but seems to return some out of range results (might be random results).

Note: the request could be returned in 1 page all records are inside that range

1) How should I handle the described workflow to get proper results? Could the problem be related to any of the following properties? (from jersey REST client)

client.register(basicAuthFeature).property(ClientProperties.FOLLOW_REDIRECTS, true)

  .property(ClientProperties.CONNECT_TIMEOUT, 0)

  .property(ClientProperties.READ_TIMEOUT, 0);

2) The default pagesize is 5000. I usually wait ~1/2 minutes to get the response back. If I increase the pageSize could I expect the same response time and achieve some better performance overall when I have many pages to read. Also what is the maximum pageSize then?

Thanks in advance!


Regards,
Sta

4 REPLIES 4
Highlighted
Not applicable

Hello Stanyu,

The IP address in nextResourceURI should be same as the one we are using in the API call. Can you please share the API url and the response here so that we can investigate if something is going wrong ?

1. If we set CONNECT_TIMEOUT as 0, The client will wait forever for the server to respond and we will not come to know if the target server is down. For mobile devices, Recommended value would be 5 seconds.

2. There is no restriction as such for pageSize. If we set the pageSize as say 60000 then it will affect the overall read-time/response time. As you correctly mentioned, default is 5000.


Regards,

Prasad.

Highlighted

Hello Prasad,

Thanks for the response.
As you said "The IP address in nextResourceURI should be same as the one we are using in the API call." - but this is not the case when I call this url -> https://64.103.39.155/api/contextaware/v1/location/history/clients?locatedAfterTime=2014-07-12T09%3A13%3A20.000%2B0300&l…

I receive this in the response: "nextResourceURI":"https://172.16.212.18/api/contextaware/v1/location/history/clients?page=2&pageSize=5000".


We did workaround this by reading the 1st page and sending another request by taking the last record 'lastLocatedTime' and using it as a param for the next request. Before that I tried to substitute the IP with the initial one, but I was not sorting the results and I thought they are somewhat random - need to test this and see if it will work as it is a better 'workaround'.

Also if I try to request pageSize > 5000 I got 'Bad Request - The pageSize maximum is 5000'. I assumed that is some limitation of the sandbox, but I would like you to confirm that - I need to make sure that I can ask for more than 5000 in a dedicated server environment.

So bottom line:
1. Can I do something so that I do not have the change the IP manually?
2. What would be the pageSize maximum in a normal server configuration?

EDIT:

3. I have a question about 'historical data'. I remember when we tested that the sandbox returned data for 11/08 and now it doesn't, but it does for 11/09, 11/10 etc. Would that mean that it has data for 1 month before the current data - if that is the case is it the same in normal servers (not the sandbox) or is it configurable?. How about 'yesterday' - the day before the current date, usually there is not data for 'yesterday' - could I do something to get this data, or configure the server to produce such?

4. When I request 'fromLastLocatedTime=some_date_in_UTC' does the server convert it or something, cause sometimes the entries 'lastLocatedTime' is with +6 offset etc. Should we take into consideration the server time zone and if yes - can we retrieve it from the API, before we do client data requests?

Thank you very much for your input!

Regards,
Sta

Highlighted

Hello Stanyu,

The sandbox you are using is probably in a DMZ, So its external address is different from its actual IP. I am discussing this issue with TechLeads to find a workaround.

This value of pageSize is configurable from the backend. Let me check if clients/partners can change this value.

For detailed information about historical data/ DB operations, You want to refer to the following documentation.

Context Aware and Location FAQ - Cisco

The statistics attribute in the History API response contains only current server time, Timezone info is available on MSE UI under /settings/generalInfo

...

"Statistics": {

                    "currentServerTime": "2015-01-06T01:28:11.819-0800",

                    "firstLocatedTime": "2014-12-17T02:31:43.051-0800",

                    "lastLocatedTime": "2014-12-21T00:47:43.569-0800"

                }

...

Highlighted

Hi,

We discussed the IP switching issue with our Tech Leads. If the MSE is in a DMZ, MSE's external and internal IP address is different. The only workaround right now is to programmatically replace the IP address in the nextResourceURI with the right one.

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