Managing New Data and Updates

The two most common methods of keeping your users' records current are push notifications and the Latest endpoint. The following guide will explain each option and present our suggested use case for handling updates.

Push Notifications vs Latest Endpoint

The primary difference between push notifications and Latest is:

  • Push notifications are intended for near real-time, individual user-level data delivery

  • Latest.json endpoint is intended for near real-time, bulk population-level data delivery.

For large population sets, push notifications don’t always make sense, as your system could end up receiving thousands of push notifications per minute. Additionally, relying on push notifications alone is not recommended for a large scale, high availability setup. The latest.json endpoint is a much more stable way to access data for a large population set.

📘

Enterprise Feature

Push notifications are only available for Enterprise customers. If you're unsure if you have access to Push Notifications, please contact your Account Manager.

Latest

When using the Latest endpoint, requests return the most recently recorded and/or updated activities for all users of an Organization which were recorded or updated between the specified start_date and end_date.​

Latest Example

GET https://api.validic.com/v1/organizations/53067e63e5afSAMPLE0008/biometrics/latest.json?access_token=93a7d46SAMPLEe08b5fa2f5748d16beSAMPLE97e87e8e047f5146da9e46d&start_date=2015-09-01T08:44:29Z&end_date=2015-12-03T08:54:27Z

By default, bulk data calls are ordered by the timestamp of an individual activity. The challenge here is that if an individual was on vacation for a week and syncs a device upon returning, how will you know about data that occurred a week ago but only just made it into the Validic system?

​The latest endpoint gives you the latest data recorded and/or updated in Validic, regardless of when the activity occurred, based on the last_updated field.

For example, if you pulled and processed Validic data at 4:00 a.m., and then you want to update your system again at 8:00 a.m., you can specify to only receive new and updated data that was added to our system between 4 a.m. and 8 a.m. by appending a timestamp with the start_date and end_date.

A best practice implementation of /routine/latest.json calls would look something like this:

Latest.json Example

/routine/latest.json?start_date=2014-03-09T10:00:00Z&end_date=2014-03-09T10:05:00Z /routine/latest.json?start_date=2014-03-09T10:05:00Z&end_date=2014-03-09T10:10:00Z /routine/latest.json?start_date=2014-03-09T10:10:00Z&end_date=2014-03-09T10:15:00Z /routine/latest.json?start_date=2014-03-09T10:15:00Z&end_date=2014-03-09T10:20:00Z /routine/latest.json?start_date=2014-03-09T10:20:00Z&end_date=2014-03-09T10:25:00Z /routine/latest.json?start_date=2014-03-09T10:25:00Z&end_date=2014-03-09T10:30:00Z /routine/latest.json?start_date=2014-03-09T10:30:00Z&end_date=2014-03-09T10:35:00Z /routine/latest.json?start_date=2014-03-09T10:35:00Z&end_date=2014-03-09T10:40:00Z /routine/latest.json?start_date=2014-03-09T10:40:00Z&end_date=2014-03-09T10:45:00Z /routine/latest.json?start_date=2014-03-09T10:45:00Z&end_date=2014-03-09T10:50:00Z

The benefit of this series of calls is that you ping Validic every five minutes (could be every 2 minutes, every 10 minutes, etc.) and you receive any updates that have been made for your organization in the specified time range. So for example, if a user doesn’t sync her Fitbit for 5 days and then syncs it on 2014-03- 09T10:47:39Z, Validic will return all of her Fitbit activities from the last 5 days in the last call in the series above.

Push Notifications

Validic provides our Enterprise customers with the ability to register for Push Notification service for near-real-time data update notifications and optimal resource use. Enterprise customers may have one or more Push Notification URLs set. To do so, contact us at support@validic.com for setting up Push Notification service for your account.

Each Push Notification sent out may include multiple items corresponding to activities that are now available for retrieval from the Validic API. Each item inside a Push Notification includes the necessary elements for you to construct an API call to retrieve a particular piece of activity data.

Once set, Validic will begin pushing data to your Push Notification URL via a POST request:

HTTP

POST http://{YOUR_PUSH_NOTICATION_URL}

JSON

Return Value

Type

Description

Return Value

Type

Description

_id

String

Validic ID of the user

activity_type

String

Type of activity data corresponding to one Validic API endpoint

activity_date

String

Timestamp for the measurement set

source

String

The short name of the application that recorded the activity

Upon receipt of a Push Notification, you may begin fetching new data from the API through a GET Request using the data parameters from the Push Notification:

HTTP

JSON

You can learn more about push notifications here.