This minor version has been deprecated

Fitness FHIR API - Fitbit Implementation Template

(0 reviews)
This Anypoint template provides an API implementation best practice to access fitness data from Fitbit, and the transforms the data into the FHIR specification for enterprise consumption. This template is included with the Accelerator for Healthcare.


This asset has been deprecated. To view the latest assets, go to MuleSoft Accelerator for Healthcare.

System APIs abstract away the complexity of core systems of record from end user data, while providing downstream insulation from any interface changes or rationalization of those systems. This API provides an implementation best practice to expose fitness data via a set of RESTful FHIR services in RAML, making it easy to consume within an enterprise.

Accelerator for Healthcare

This FHIR implementation is one of many components included in Accelerator for Healthcare. It provides organizations with connectivity assets that accelerate project delivery in healthcare, including pre-built API designs and implementations that support core healthcare business processes.

Contact for more information.

License Agreement

This template is subject to the conditions of the MuleSoft License Agreement. Review the terms of the license before downloading and using this template. You can use this template for free with the Mule Enterprise Edition, CloudHub, or as a trial in Anypoint Studio.

Use Case

As a FitBit user I want a microservice to access data from the FitBit system and transform them to FHIR standard.

Healthcare Fitbit to FHIR System API is part of the Healthcare Templates Solution. This template calls FitBit API to retrieve required data from the FitBit system and transforms them to JSON following the FHIR specification version 3.0.1 STU3.


To make this template run, there are certain preconditions that must be considered. Failing to do so can lead to unexpected behavior of the template.

Use Anypoint Studio v7.1.4 and later and Mule Runtime 4.1.1 and later to run this template.

Register your Fitbit Application

Create a new developer app at with the OAuth 2.0 Application Type β€œServer”. Note that you need to define the Callback URL too. This is important as you would need to set this URL in property fitbit.redirect.uri.

Key parameters to note once you’ve registered your app is the OAuth 2.0 Client ID, the Client (Consumer) Secret, and the Redirect URI.

Run the Application

Access the Fitbit OAuth login from a web browser at:

This gets you to the login landing page where you fill in your email and password. After the successful log in you are redirected to the URL specified in the app at You can notice the access code in the URL.

To register a patient to this Fitbit account you need to do create the request GET{id}/register?code=YOUR_ACCESS_CODE where {id} represents the Patient ID, who wants to authorize to Fitbit account and access code is the one obtained after login with Fitbit credentials.

Run it!

Simple steps to get Healthcare Fitbit to FHIR System API running.

Where to Download Anypoint Studio and the Mule Runtime

If you are new to Mule, download this software:

Note: Anypoint Studio requires JDK 8.

Import into Studio

In Studio, click the Exchange X icon in the upper left of the taskbar, log in with your Anypoint Platform credentials, search for the template, and click Open.

Run in Studio

After you import the Template into Anypoint Studio, to follow these steps to run it:

  1. Generate a keystore and set up the truststore (you can find a detailed description on how to do so in TLS Configuration).
  2. Locate the properties file, in src/main/resources.
  3. Complete all the properties required as per the examples in "Properties to Configure".
  4. Right click your template project folder.
  5. Hover your mouse over Run As.
  6. Click Mule Application.

Run Stand Alone

Fill in all the properties in one of the property files, for example in and run your app with the corresponding environment variable to use it. To follow the example, use mule.env=prod.

Run on CloudHub

When creating your application in CloudHub, you need to go to Manage Application > Properties to set all environment variables detailed in the "Properties to Configure" section.

Deploy on CloudHub

In Studio, right click your project name in Package Explorer and select Anypoint Platform > Deploy on CloudHub.

Properties to Configure

To use this template you need to configure properties either in a properties file or in CloudHub as Environment Variables. To run the MUnit tests, the configuration file is located in the

Application Properties

  • https.port 8082
  • token.refresh.poll.frequencyMinutes 30
  • token.refresh.poll.startDelayMinutes 2

  • keystore.location keystore.jks

  • keystore.password password1234
  • key.password password1234
  • key.alias alias

  • baseUri

    Note: You should encode the fitbit.redirect.uri


  • fitbit.redirect.uri redirect.uri.defined.also.on.fitbit.side
  • 12345
  • fitbit.client.secret fsd5fd45fs5d4f45sdf5d


Fitness FHIR API - Fitbit Implementation Template doesn't have any reviews yet
Created byMuleSoft Organization
Published onDec 7, 2018
Asset overview

Asset versions for 2.1.x

StatusVersionRuntime versionActions


SalesforceNo values left to add
Industry Vertical
HealthcareNo values left to add