Testing with Inform

Once you're ready to test your code, you must create a user and connect a device. Before you begin testing your code, start by testing to ensure you have an active connection and data is making it into our API.

Provision a User for Testing

To get started, you will need to provision a user to use in testing. We suggest that you use a new user and new data source account for every testing instance. For instance, if you have 3 test users, you should have 3 Fitbit accounts. Most data source accounts are free and easy to set up. Do not reuse the same account across multiple UIDs. Most data sources will not allow this and disconnect the previously connected UID. This will cause you to assume there are errors in testing when the data source is functioning as intended.

To provision a user, you will need to follow the instructions on this page: https://helpdocs.validic.com/docs/provision-and-managing-users

The marketplace URL for your user will be in the returned content after provisioning the user.

Creating a workout in Fitbit

  1. Download the Fitbit app and set up a free account.
  2. Open your Validic marketplace and authorize Fitbit access.
  3. Back in the Fitbit app, select "track your exercise" from the home screen.
315
  1. Click the stopwatch
318
  1. On the IOS app, set the toggle to "log." On the Android app, click on "Log Previous."
  2. Select an exercise and complete the log. I like to use "bike," but feel free to play around with different options.
  3. You may choose to alter the duration, etc. Select "Add" when complete on the IOS app. On the Android app, click "Log It" when complete. If you log 100 miles on a bike in 30 minutes, you will travel at 200mph! Now that is a workout!
    Wear a helmet even if you are logging this at your desk manually. Safety first!
319
  1. This will generate a workout record. Using the restful API, call the workout resource. You will need your Org ID and the UID of the user. The user should be the one you used to authorize FitBit access in your marketplace. Here is an example of that call:
https://api.v2.validic.com/organizations/59bYOURORGID00001e13e75/users/vptYOURUID5sp/workouts?token=6a433824YOURTOKEN84b24ad0
  1. The result should be something like this:
{
    "data": [
        {
            "category": "biking",
            "checksum": "c0aef986a17f873416c0eeeb7767a3c6",
            "created_at": "2022-09-01T17:11:04.904Z",
            "deleted_at": null,
            "end_time": "2022-09-01T16:39:00Z",
            "id": "edbc9ade394e4539805a0fd15c1f2d9a",
            "log_id": "50497125882",
            "metrics": [
                {
                    "type": "distance",
                    "origin": "manual",
                    "unit": "m",
                    "value": 160934.402
                },
                {
                    "type": "active_duration",
                    "origin": "manual",
                    "unit": "s",
                    "value": 1800.0
                },
                {
                    "type": "energy_burned",
                    "origin": "manual",
                    "unit": "kcal",
                    "value": 633.0
                },
                {
                    "type": "avg_speed",
                    "origin": "manual",
                    "unit": "m/s",
                    "value": 89.40800111111112
                },
                {
                    "type": "workout_duration",
                    "origin": "manual",
                    "unit": "s",
                    "value": 1800.0
                },
                {
                    "type": "fairly_active_duration",
                    "origin": "device",
                    "unit": "s",
                    "value": 0.0
                },
                {
                    "type": "lightly_active_duration",
                    "origin": "device",
                    "unit": "s",
                    "value": 0.0
                },
                {
                    "type": "very_active_duration",
                    "origin": "device",
                    "unit": "s",
                    "value": 1800.0
                }
            ],
            "name": "Bike",
            "offset_origin": "profile",
            "segments": [],
            "source": {
                "type": "fitbit",
                "device": null
            },
            "start_time": "2022-09-01T16:09:00Z",
            "tags": [],
            "type": "workout",
            "user": {
                "organization_id": "59bYOURORGID00001e13e75",
                "user_id": "vptYOURUID5sp",
                "uid": "NewGuyTestsSome"
            },
            "user_notes": [],
            "utc_offset": -14400,
            "version": "1.0"
        },
        {
            "category": "biking",
            "checksum": "ca4c16aff83d3e043cffef2cf50a0504",
            "created_at": "2022-09-01T17:11:04.963Z",
            "deleted_at": null,
            "end_time": "2022-09-01T17:09:00Z",
            "id": "f2ac771ee1561e1e5ede4c8fff0fe8a3",
            "log_id": "50505111950",
            "metrics": [
                {
                    "type": "distance",
                    "origin": "manual",
                    "unit": "m",
                    "value": 160934.40000000002
                },
                {
                    "type": "active_duration",
                    "origin": "manual",
                    "unit": "s",
                    "value": 1800.0
                },
                {
                    "type": "energy_burned",
                    "origin": "manual",
                    "unit": "kcal",
                    "value": 633.0
                },
                {
                    "type": "avg_speed",
                    "origin": "manual",
                    "unit": "m/s",
                    "value": 89.40800000000002
                },
                {
                    "type": "workout_duration",
                    "origin": "manual",
                    "unit": "s",
                    "value": 1800.0
                },
                {
                    "type": "fairly_active_duration",
                    "origin": "device",
                    "unit": "s",
                    "value": 0.0
                },
                {
                    "type": "lightly_active_duration",
                    "origin": "device",
                    "unit": "s",
                    "value": 0.0
                },
                {
                    "type": "very_active_duration",
                    "origin": "device",
                    "unit": "s",
                    "value": 1800.0
                }
            ],
            "name": "Bike",
            "offset_origin": "profile",
            "segments": [],
            "source": {
                "type": "fitbit",
                "device": null
            },
            "start_time": "2022-09-01T16:39:00Z",
            "tags": [],
            "type": "workout",
            "user": {
                "organization_id": "59bYOURORGID00001e13e75",
                "user_id": "vptYOURUID5sp",
                "uid": "NewGuyTestsSome"
            },
            "user_notes": [],
            "utc_offset": -14400,
            "version": "1.0"
        }
    ]
}
  1. If you do not see your results, immediately open the Fitbit app and "pull-down" on the screen. This will force the app to refresh and connect with the cloud. Do note that if you don't see the data immediately in the rest API call, then be patient. We are dependent on the Fitbit API delivering data to us. This can take up to 2 minutes but sometimes longer, depending on how fast Fitbit provides the data. It will be immediately available as soon as we receive it in the RESTful API call.

  2. With data appearing in the RESTful API, try opening a stream in a web browser. Use the Get Streams call to get a list of your streams: https://streams.v2.validic.com/streams/?token=6a433824YOURTOKEN84b24ad0. Using the ID and your API token, open the stream in your web browser and ensure data flows into the stream. It should look something like this:

2467
  1. With all this confirmed, you can start testing your code. If you still have issues, reach out to your Validic representative if you are testing and not a current customer. If you are already a Validic customer, then reach out to the support team so that they can assist you with any issues/ questions you have.