Health Cloud API, Web Tiles and Bex
Last week the Microsoft Band team released a number of interesting and cool features. We're also going to highlight two different examples of using these two features, one by Shawn Kendrot and another by Scott Lovegrove.
Today, we take the next step that enables programmatic access to even more facets of Microsoft Band and Health platform – by introducing Microsoft Band Web Tiles Preview and Microsoft Health Cloud API Preview.
With this new preview, we are making it even easier for developers to create tiles for Microsoft Band, and are providing the first opportunity for developers to gain access to the rich fitness data that is stored in the Microsoft Health platform.
Introducing Microsoft Band Web Tiles Preview
The Microsoft Band Web Tiles Preview makes it simple to deliver “glanceable” information to Microsoft Band from virtually any data source accessible through the web. Web Tiles use the power of the Microsoft Health platform, leveraging internet connectivity, to bring content directly to the Microsoft Band.
With Microsoft Band Web Tiles, developers “author” the web tile only once to support multiple mobile platforms (iOS, Android and Windows). Authoring a Tile is simple: Developers can choose to read the Web Tiles documentation and author the Web Tile using their favorite text editors, or they can choose to author the tiles using the newly released Web Tiles Authoring Tool which provides a UI-based, step-by-step guide to creating a Web Tile package in as little as five minutes.
Microsoft Band Web Tiles are supported on all mobile platforms where Microsoft Health is available. To get started, developers should visit the Microsoft Band Web Tiles developer site, read the comprehensive documentation, download sample Web Tiles, and start creating new Web Tiles using the Web Tiles Authoring Tool.
Introducing Microsoft Health Cloud APIs Preview
Additionally, we are excited to bring you a preview of our Microsoft Health Cloud APIs Preview. These APIs are built on open standards and are a first step towards achieving our goal of making Microsoft Health extensible.
They allow developers to enhance the experiences of their apps and services with fitness data coming from Microsoft Health. These apps and services will be able to drive even more insightful and rich health and fitness features, like observations and insights, personalized recommendations and fitness coaching, by building upon a baseline of information provided by a consenting user.
As part of the preview, the first set of APIs that we are providing are read-only APIs for Activities and Summaries designed to provide developers read operations for Microsoft Health activity data, as well as interval based summaries for biometric data. When a user finishes a run, an application can query the Activities API and access details of the run as well as map points for the entire run that can then be used to create a map.
The full list of APIs is as follows:
The Microsoft Health Cloud APIs preview provides you with all the tools to start building your apps today. Start by registering your application and visit the developer page to download a sample application, read up on the Getting Started documentation, and browse the API Reference.
New enhancements to Microsoft Band SDK
In addition to releasing the above new features for our developer community, we have made even more enhancements to the existing Microsoft Band SDK experiences based on feedback and issue reports.
Based on feedback from inquiring Developers, we are addressing the following areas with this update:
- Refreshing of 3rd-party tile contents in-place
- Better support for building icons as buttons
- Ability to control the tile screen timeout
Visit the Microsoft Band SDK developer site to read more about these improvements and existing features.
Shawn Kendrot now shows off how easy it is to create a new Web Tile for the Band.
The Microsoft Band team released “Web Tiles” today. Web Tiles are a simple way to show tiles on your Microsoft Band without needing to write an app. The tiles update from a web url. As far as I can tell, the web url must return json data. This data can be whatever but it needs to be open to everyone meaning no authentication. All of the articles today talk about the structure of a web tile and what each piece means. All this information is great, but if you only need a simple tile you can do without it.
Along with the release of Web Tiles, Microsoft also released a Web Tiles Authoring website. This website walks you through creating a new tile step by step. Let’s take a look at how this works
Step 1: Choose a layout
Here you pick which of the six layouts you’d like to use for the tile. You can choose from displaying a single page tile or multiple page tile. Multiple page tiles must link to an RSS or ATOM feed. This is not a requirement of web tiles; it is only a requirement for the authoring tool. Web tiles can have multiple pages without needing an ATOM or RSS feed.
Step 2: Assign the url ...
Step 3: Selecting information to display ...
Step 4: Make it yours ...
Step 5: Download!
Scott Lovegrove now shows off a cool PCL Library that will make using the Microsoft Health APIs that much easier...
Yesterday Microsoft [finally] released the MS Health APIs they’d talked about at this year’s Build conference. These APIs are a way of accessing the data that’s been accrued from your Microsoft Band, so any bike rides, runs, sleep tracking, etc. These APIs are a set of REST endpoints that, once authenticated, you can call to access this data. So, naturally, I’ve decided to make this easier.
Bex is a PCL library that allows you to easily connect to the MS Health APIs. It contains methods to ease signing users into their Microsoft Account, then provides methods to pull back their data.
If you’re using the Live SDK and already have your login scenario handled, then most of this can be ignored. If that is the case, you need to create an instance of LiveIdCredentials and provide the access token you’ve already acquired for the user; then just call IBexClient.SetCredentials() and pass in that LiveIdCredentials instance.
For the rest of you, I provide the oAuth url required so that you can send the user to the Microsoft Login page, all you need to do is provide the list of scopes that you wish to have access to, and, if required, the redirect url.
If you’re building a Windows phone, Windows, or UWP app, leave the redirect url blank and use the WebAuthenticationBroker; there is a constant on BexClient for the internal RedirectUrl being used (see the sample project). The above code is taken from a Windows Phone 8.1 app.
Making the Calls
Once your user is authenticated, you are then free to start requesting the user’s data. An example would be to get the user’s profile information
It wouldn’t be a solution from me without the source code being available on GitHub. If you want to build this project from the source code, you will need to be using Visual Studio 2015 as the code in there uses some of the new C#6 syntax.