Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Activity Log: Start an activity by API like it was done on the device

ANSWERED

Hello experts,

 

we're working in a szenario where an external system starts a job to be done by a human wearing a Fitbit device. The idea is to sync the start of job in the external system with a start of a custom activity tracking by fitbit device like it coud be started with the button e.g. at a ChargeHR.

 

If the external job is done, we like to stop the activity together with suppling job details, like description of the external job.

 

As a result, the user has a Activity Log entry reflecting the external job's effort.

 

Expected flow would look like (user login already done):

1) external system starts a job J

2) this job is assigned to a user U
3) external system calls API U.ActivityLog.create()
4) device is in activity "recording" mode like user could have done locally on device itself

5) user U executes his job, activity (steps,...) are recored

6) user U complets the job, reports "i'd compleded" within the external system

7) external system calls API U1.ActivityLog.stop( desc="Working very hard on job=xxx for the money"

😎 user U now have a Activiy Log with read counted steps, calories,... for this job J

 

This seems not possible to us right now with the ActivityLog ?

 

Thanks for any ideas,

 Mathew

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

@MathewB Assuming the user doesn't use exercise mode on their device, and the training tool you're talking about can capture start/end time, and also if you have access to intraday time series, then you can make requests such as this:

 

https://api.fitbit.com/1/user/-/activities/steps/date/today/1d/15min/time/08:00/08:45.json

https://api.fitbit.com/1/user/-/activities/distance/date/today/1d/15min/time/08:00/08:45.json

https://api.fitbit.com/1/user/-/activities/calories/date/today/1d/15min/time/08:00/08:45.json

 

to pull data for the period of time the 'system guided task' was performed. Then you can use that data to log a custom activity.

 

Andrew | Community Moderator, Fitbit

What motivates you?

View best answer in original post

Best Answer
0 Votes
7 REPLIES 7

@MathewB With what you described, I don't think that's possible to do. Sorry. Robot Sad

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Thank you for the information. This was also my concern ...

 

Do you see a way to emulate this process flow with other API calls ?

 

Besides, would'nt it be a cool feature e.g. for fitness studios to start fitbit activity tracking remotly by the training tool if user starts a training there ?

 

We plan to use fitbit devices in a business environment (during work) to track activity in parallel to a system guided task which has to be executed by the worker. The Activity Log recordings should reflect the fulfilled work.

 

So I'd like to bring in a "feature request" for this 🙂

Best Answer
0 Votes

@MathewB Assuming the user doesn't use exercise mode on their device, and the training tool you're talking about can capture start/end time, and also if you have access to intraday time series, then you can make requests such as this:

 

https://api.fitbit.com/1/user/-/activities/steps/date/today/1d/15min/time/08:00/08:45.json

https://api.fitbit.com/1/user/-/activities/distance/date/today/1d/15min/time/08:00/08:45.json

https://api.fitbit.com/1/user/-/activities/calories/date/today/1d/15min/time/08:00/08:45.json

 

to pull data for the period of time the 'system guided task' was performed. Then you can use that data to log a custom activity.

 

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Hello API experts,

our aim is to create a chronology of tasks as an overlay on top of the tracking data.

Do get this, we use (as suggested) the intra day data of steps, distance and calories per user. Then we POST activities.json to add a manual activitiy (activityName=Test) in the example every time a task is finished. The custom activity should document steps & distance & have a individual description.

 

What is annoying to me ...  a custom activity does not have steps, only a distance. But technically (if we add a activity in the past, real tracking data is already there, thus we need neither distance, nor steps, nor calories at all if our task's workload does not add addtitional calories.

These added activities can be fetched with GetActivityLogList.

 

But in dashboard, an activity record could be created (which behaves better to our expectations)

Example below "Travel to work". But this kind of activities added in WebGUI are not listed in the activity list API call ? What's the difference here between these two kinds of activities ?

 

hc2.jpg

 

 

 

 

 

 

So a activity for our task equivalent might look like { start:"datetime" end:"datetime" description:"Task #1" additionalCalories: 212 }. Steps & distance are references to tracked data.

 

If these data is supplied (steps/distance/calories) without real tracker data in this time interval, it's fine but what happens, if tracked data & manual data is there.
Tracker data says 1km from 9:00 to 10:00 with 1000steps and the manual activity says start: 09:00:00 duration: 1h, distance: 0,5km steps: 400 ?

 

Thanks in advance,

 MathewB

Best Answer
0 Votes

@MathewB Activity records are not returned via the API.

 

Manual activity data is excluded from activity records, only tracker data will show.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Hmm, thanks. I think asking "why" is unrewarding.

 

The GetActivitiesLogList has a logType to differentiate all kinds of entries. Thus the call could return all data like shown in the WebGUI. Is there a chance to enhance the API here ?

 

What is still unclear to me is the model behind the activities ...

 

For me, the model consists at least of 4 layers.

1) the raw tracker data from sensors (steps, heart rate, air pressure, GPS, g-patterns)

2) the calculated data inside the tracker (distance, calories, floors, ...) derived from 1) and user master data

3) the calculated data inside your plattform (activity logging from g-pattern detection) derived from 1) and 2)

4) the manual entered activities on top/as alternative or in addition to all of this

 

A manual activity can bring in data at layer 1) if user missed wearing the tracker during training (the g-patterns are replaced by entering a activity type). This kind of manual data should only be possible in timeframes where no tracker data is there.

 

But it can also bring in more data in addition to layer 1) data. This leads to the question how the two datasets are combined. Would it be possible to get a bit more details about that ?

 

Thanks,

 MathewB

 

Best Answer
0 Votes

MathewB wrote:

The GetActivitiesLogList has a logType to differentiate all kinds of entries. Thus the call could return all data like shown in the WebGUI. Is there a chance to enhance the API here ? 


@MathewB This has been relayed internally in the past, but as Jeremiah said in a different thread, it's an uncommonly used legacy feature.

 


MathewB wrote: 

But it can also bring in more data in addition to layer 1) data. This leads to the question how the two datasets are combined. Would it be possible to get a bit more details about that ?


@MathewB Manually logged activities (not activity records) will override tracker data.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes