Subscription API

Overview

LFconnect users upload their workout data through various means, Lifefitness equipment , the LFconnect Mobile Apps and LFconnect website . With the LFOpen providing means for the developers to use the user information many Apps have utilized this opportunity to provide best services to the users. Users can choose to use other Apps which has integrated with LFconnect.

The users using either of these means can upload their data in different frequency. For the developers who needs user data in realtime it will be additional overhead to keep polling for latest data.

LFOpen's Subscription API helps the developers to reduce this overhead by providing notifications whenever the user data is updated. This helps the developers in concentrating on using the data rather than finding a way to get latest data.

This option is available for the Web API enrollment Type.

The subscription API is a push model where the notifications are pushed to the subscribers based on their subscription. This is loosely based on the PubSubHubbub model

The notifications are sent to the subscribers in near real time.

What should the developers do

Subscription registration

The developer can subscribe to specific subscription Types (sub Types) while creating an Application in the LFOpen website. This option is available for the Web API enrollment Type. The developer has to enable subscription while creating App Developer Application Registration

A URL need to be provided as the callback URL to recieve notifications. Either a single URL can be provided for all the subscription Types or each subscription Type can be provided by a separate callback URL.

Subscription Types

Subscription is provided for the following events

  1. Profile Updated : [subType= Account] This provides notification for every User profile modification.
  2. Manual workout :[subType=Manual] This provides notification for every manual workout posted by the user. This includes manual cardio and manual strength workouts. The manual workout posted can be through the LFconnect website or any clients authorized by the user.
  3. Lifefitness workout : [subType=Lifefitness] This provides notification for every workout completed by the user in any Lifefitness equipments.
  4. GPS workout :[subType= GPS] This provides notifications for the GPS outdoor posted workouts through any of the clients authorized by the User

Set up Callback URL

The developer can create a listener in their application to recieve the URL notifications. The URL called is a POST request. The callback URL is called with two parameters.

  1. subType : The subscription Type for which the notification is sent
  2. access_token: The user access token provided by LFconnect for the specific user. This can be used to distinguish the user which has recent updates for the subscription Type

Read about OAuth for details on user access token

The LFopen will only notify any change in the users data.The developer based on the notification should call the specific service to get the latest updated information.

For example : User A has authorized for the developer application.

The callback URL registered is

http://appurl/notification/account .

When the user profile has been updated then the callback URL is called

http://appurl/notification/account?subType=account&access_token=hskroxn2o4ishm456