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

How to collect user first login time and last logout time through REST API's

Team


I am planning to build an attendance system using cisco CMX cloud REST API's(Presence analytics ).

Basically, I need first login time and last exit time (every day) of  all the mobile devices which are connected to WIFI.

Please suggest the better way to achive this.

Everyone's tags (3)
11 REPLIES 11
Frequent Contributor

Re: How to collect user first login time and last logout time through REST API's

hello,

are you using the connect api?

https://cmxpresencesandbox.cisco.com/apidocs/connect-api#Operations-to-query-visitor-user-session-data-GET-Query-User-Sessions

please, let us know more details of your use case.

thanks,

matt

Beginner

Re: How to collect user first login time and last logout time through REST API's

Dear Matthew

My use case is simple.

I want to build for time attendance application. For that, I need to pull the data from CMX cloud Data(considering all the users connected to wifi).

So I need a CMX API which should return the first login and last exit time of all the users(every day) connected to particular Access point or controller.

So that I can use this API to build the time attendance system.

Frequent Contributor

Re: How to collect user first login time and last logout time through REST API's

Hi,

Please, see the https://www.cisco.com/c/en/us/td/docs/wireless/mse/cmxcloud/api/b_cmxcloud_api_reference.html under Connect resource. 

Login to Cisco CMX Cloud from Chrome browser, then open another tab and enter https://<tenant_id>.cmxcisco.com/api/connect/v1/clients with various search criteria.

Hope this is the resource you are looking for,

Matt

Beginner

Re: How to collect user first login time and last logout time through REST API's

Dear Matthew

No.. This is not correct.

Let me give a sample use.

I want to know all employees entry and exit time in my office like a time attendance system.

(assume all of them connected to wifi of particular site).

I need to know the first entry timestamp  (means when a particular mobile device of employee connected to wifi first time for a day ) and last exit timestamp of the day.

Please share me your contact details.

Frequent Contributor

Re: How to collect user first login time and last logout time through REST API's

Hi,

The Presence API returns counts, averages, sums, etc. where the Connect API will return a query of user session data based on criteria such as MAC addresses, last session time, status, and any or all fields.  Cisco Connected Mobile Experiences Cloud REST API Guide - Connect [Cisco Connected Mobile Experiences (CMX) Cloud] - Ci…

A custom portal can be used to request registration information from the sign-in page, and can be used as data source for your reports.  Information such as Name, Email, Phone, Social Auth is captured.

Here is an example of the Connect API resource.

/api/connect/v1/clients

{

  "returnRecordCount": 1,

  "records": [{

  "agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/58.0.3029.110 Safari\/537.36",

  "Email": "matfarre@cisco.com",

  "language": "English",

  "bytesSent": 0,

  "type": "CustomPortal",

  "ssid": "null",

  "operatingSystem": "Intel Mac OS X 10",

  "Name": "matthewjfarrell",

  "lastLoginTime": "Jun 2, 2017 4:01:08 PM, UTC",

  "lastLogoutTime": "Jun 2, 2017 4:01:08 PM, UTC",

  "macAddress": "null",

  "bytesReceived": 0,

  "firstLoginTime": "Jun 2, 2017 3:56:17 PM, UTC",

  "clientIp": null,

  "location\/Site": "Global",

  "state": "active",

  "authType": "REGISTRATION",

  "portal": "CMX Presence",

  "device": "Macintosh",

  "lastAcceptTime": "Jun 2, 2017 4:01:08 PM, UTC"

  }],

  "timeZoneOffset": 0,

  "queryRecordCount": 1000,

  "timeZone": "Coordinated Universal Time",

  "nextIndex": 1000

}

Let us know if you have any questions,

Matt

Frequent Contributor

Re: How to collect user first login time and last logout time through REST API's

Hi,

You can also download a CVS of Visitor Search to get all the fields, such as Social login data.

From Connect & Engage, choose "Export all Visitors".

Let us know if you are road blocked or have questions.

Matt

Beginner

Re: How to collect user first login time and last logout time through REST API's

Dear Matthew

My requirement is simple

I need first login time of the users every day(connect and encage module ).

Currently its giving only first login for whole which means its giving the very first time when the device connected to wifi. But I need first login time every day.

Based on the call with your support team it’s not possible with current api’s.

Let me know if there is any other options.

Regards

Kannathasan

Frequent Contributor

Re: How to collect user first login time and last logout time through REST API's

Hi,

I understand the issue now, the first login time per session (start to end parameters) is missing.

I will open a CDETS ticket to request this enhancement.

Thanks,

Matt

Update:  Since CMX Cloud (currently deployed with only Presence Analytics) does not keep historical location data, an additional parameter is proposed dailyLoginTime to use for daily reports.  This parameter will be overwritten each day.

CSCve78145

Headline:

GET: Query User Sessions first login time per day is needed for customer use case.

Description:

The /api/connect/v1/clients REST API provides firstLoginTime (historical), lastLoginTime (updated on each login).  The first login time per day is needed to determine daily presence at a place or event.

The Connect API is the appropriate resource to use to pull employees/students entry and exit time from office/classroom, like a time attendance system.  However, this will require a new parameter dailyLoginTime for first login time of each day (occurring every day or every weekday).  Currently firstLoginTime is the first time the device is connected.  With this new parameter dailyLoginTime the customer can use the Connect API for daily reports of all the mobile devices which are connected to WIFI.

Beginner

Re: How to collect user first login time and last logout time through REST API's

Hello Matthew,

I would like to know if you have any answer about this issue.

I am trying to get user information from Daily Login Time, but without success.

Do know another string to get it?

https://10.100.101.222/api/connect/v1/clients/(what else?)


Regards,


Rafael

Frequent Contributor

Re: How to collect user first login time and last logout time through REST API's

Hi,

Checking the CDETS ticket opened, this was ignored at the time. Possibly an enhancement has been made since that time, though.  Here is the developer's comment:

Connect DB doesn't maintain client history. To meet the new requirement, it's a major effort and DB size will increase dramatically. There's no plan for such big change as of now.
Fortunately, there are 3 workarounds:

  1. customer query connect API and do filtering on lastLoginIn & lastLogout timestamp daily. This way, customer will get client stay with WiFi duration in last 24 hours
  2. customer subscribe notification of client association and disassociation event.
  3. customer query location API and get more client history information with location API as below. A given mac with given date, it can show how long this client present at a venue by sorting chgOn (last time stamp - first time stamp):

https://10.22.243.125/api/location/v1/historylite/clients/b8:e9:37:3c:69:d8?date=2017/06/12

Thanks.

Beginner

Re: How to collect user first login time and last logout time through REST API's

Beside API calls, you can use Prime "session reports" which records data you are after.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.