====Live Data API==== Access to live data is via the //consolidator// - a service that is specifically designed to provide the latest information to clients. The consolidator is accessed with HTTP (REST) calls. You can access live information either though a //snapshot//, which is a single, instant image of the current values, or through a //subscription//, which notifies you of changes in the data you're monitoring. ===SDKs=== ARDI ships with two SDK toolkits to allow you to connect to live data with minimal fuss. * [[Javascript Live Data API]] * [[Python Live Data API]] If you aren't using one of these languages or you'd like to understand what is going on under the hood, see the documentation below... ===Getting the Consolidator URL=== The first step (which is handled for you in the SDKs above) is to discover the correct URL for your consolidator. If you have a multi-site ARDI system, each site has its own unique consolidator, running on a different TCP port. If you send a HTTP GET request to http:///api/connect This will return an XML file that will indicate the correct host address and port number to use to access the consolidator. ===API Functions=== ^Name^Usage^ |[[snapshot|snapshot]]|Used to get all of the current values for a set of data points. This function does **not** create a subscription.| |[[subscribe|subscribe]]|Returns all current values and creates a subscription to allow you to track changes using the //update//function| |[[unsubscribe|unsubscribe]]|Closes a subscription created with //subscribe//| |[[update|update]]|Returns the data that has changed since the last update/subscribe request| ===Example Life-Cycle=== This is an example of how an application usually connects to and monitors live data from an ARDI server... Find the Consolidator Host & Port from /api/connect Create A New Subscription from /subscribe?codes= While Running... Keep Updating The Data from /update?id= Unsubscribe from /unsubscribe?id= Remember to pass '&format=json' to each of these functions if you'd prefer your results in JSON format rather than XML.