Validic Inform

Validic Inform Developer Hub

Welcome to the Validic Inform developer hub. You'll find comprehensive guides and documentation to help you start working with Validic Inform as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Replay a Stream

GET /replay

The Replay Stream is intended to be used by customers that want to replay the event stream. For instance, if there were errors processing events from the Stream, a connection to the Replay stream would allow customers to replay and reprocess events. By default, each connection will send all the data for all the users processed over the last 30 days.

Opens a connection and streams data for the customer using Server Sent Events (SSE). This creates a long-lived HTTP connection where a poke event will be sent every 5 seconds. As soon as new content is available, information will be sent in a data event.

A Content-Type response header of text/event-stream will be returned, indicating a long-lived HTTP connection, in which data will be streamed to the client.

REPLAY LIMITS

  • Replay functionality should only be used for reconciliation or recovering data. Replay streams are limited to 5 concurrent replays per account.
  • Replay streams do not offer load balancing, the connection is limited as one stream per client and each client that connects to a replay stream will receive the entire stream.
Name
Required Fields
Type
Description

date

optional

string

Used to change request date. The client will only receive events where the created_at date of the event (also known as the processed time) is on or after the provided date parameter. Must be in YYYY-MM-DD format. Ex: ?date=2017-04-01

resources

optional

string

Used to limit events to only the specified resource types. The client will only receive events where the resource type matches one of the provided values. Ex: ?resources=summary OR ?resources=summary, measurement
Valid values:

  • measurement
  • nutrition
  • sleep
  • summary
  • workout

HTTP Response Status

Response Code
Description

200 (OK)

Indicates the request was received and a result was returned.

400 (Bad Request)

Indicates that the request was invalid.

Code Samples

https://streams.v2.validic.com/replay?resources=summary,measurement&token=6f46db36dd6543d2b82d91698fcd0896&date=2017-07-30
https://streams.v2.validic.com/replay?resources=summary,measurement&token=6f46db36dd6543d2b82d91698fcd0896&date=2017-07-30
event:poke 
data:{  
   "ts":"2017-08-04T19:29:18.921Z"
}

event:data 
data:{  
   "category":"daily",
   "checksum":"57e5f8fc1605a695a7070ae6631424fa",
   "created_at":"2017-07-30T00:05:34.965Z",
   "deleted_at":null,
   "end_time":"2017-07-30T03:59:59Z",
   "id":"5de711ed704b3652d66c26132e01bdff",
   "log_id":"2017-07-29",
   "metrics":[  
      {  
         "origin":"device",
         "type":"active_energy_burned",
         "unit":"kcal",
         "value":79.0
      },
      {  
         "origin":"device",
         "type":"basal_energy_burned",
         "unit":"kcal",
         "value":1636.0
      },
      {  
         "origin":"device",
         "type":"distance",
         "unit":"m",
         "value":240.0
      },
      {  
         "origin":"device",
         "type":"elevation",
         "unit":"m",
         "value":3.05
      },
      {  
         "origin":"device",
         "type":"energy_burned",
         "unit":"kcal",
         "value":1702.0
      },
      {  
         "origin":"device",
         "type":"floors_climbed",
         "unit":"count",
         "value":1
      },
      {  
         "origin":"device",
         "type":"steps",
         "unit":"count",
         "value":341
      },
      {  
         "origin":"device",
         "type":"heart_rate_zone_very_low",
         "unit":"s",
         "value":0.0
      },
      {  
         "origin":"device",
         "type":"heart_rate_zone_low",
         "unit":"s",
         "value":0.0
      },
      {  
         "origin":"device",
         "type":"heart_rate_zone_medium",
         "unit":"s",
         "value":0.0
      },
      {  
         "origin":"device",
         "type":"heart_rate_zone_high",
         "unit":"s",
         "value":24240.0
      },
      {  
         "origin":"device",
         "type":"resting_heart_rate",
         "unit":"bpm",
         "value":62
      }
   ],
   "offset_origin":"profile",
   "segments":[  

   ],
   "source":{  
      "type":"fitbit"
   },
   "start_time":"2017-07-29T04:00:00Z",
   "type":"summary",
   "user":{  
      "organization_id":"597752338a5da500014a1f9a",
      "uid":"277040620-sol3",
      "user_id":"5978f4198a5da50001809f82"
   },
   "user_notes":[  

   ],
   "utc_offset":-14400,
   "version":"1.0"
}event:poke 
data:{  
   "ts":"2017-08-04T19:29:28.921Z"
}event:poke 
data:{  
   "ts":"2017-08-04T19:29:33.922Z"
}

Response Field Descriptions

version

string

Indicates the resource payload version. Validic will make future updates to the structure of the resource payload where breaking changes will receive a new version.

ts

string

Time stamp which identifies when data entered the stream.

event:poke

string

A pke event acts as a "heart beat" which indicates the stream is active.

id

string

Unique identifier for the record.

checksum

string

A derived value useful when comparing records with the same id for data updates.

type

string

The Validic Resource type. For Measurement records the type will be measurements.

start_time

string

The start time of the event represented in UTC. Format: YYYY-MM-DDThh:mm:ssZ.

end_time

string

The end time of the event represented in UTC. Format: YYYY-MM-DDThh:mm:ssZ.

utc_offset

integer

The offset in seconds from UTC.

offset_origin

string

The source of the UTC offset. Valid values: source (UTC offset received from the original record), profile (UTC offset received from the source's user profile), user_defined (UTC offset provided by user's time zone selection upon authorization through the Validic Marketplace).

user

object

A User object that contains identifiers related to the user.

user>uid

string

The customer's user ID.

user>user_id

string

Validic user ID.

user>customer_id

string

Validic customer ID.

log_id

string

The unique identifier for the record provided by the source.

source

A source object that contains source specific information.

source>type

string

The source Validic retrieved the data from.

source>device

object

A device object containing information about the device that generated the data if available.

source>device>name

string

The name of the device.

source>device>type

string

The type of the device.

name

string

A free form field that defines the meal type or food type for the record.

category

string

The category of the meal. Valid values: food, meal, other.

metrics

array

An array of Metrics. Refer to the Metrics documentation for further information.

segments

array

An array of Segments. A more granular view of the items that compose the nutrition event.

segment>name

string

A free form field that defines the food type for the segment.

segment>metrics

array

Metrics for the given segment.

created_at

string

The record processed time represented in UTC. Format: YYYY-MM-DDThh:mm:ssZ.


Replay a Stream

GET /replay