NikeFuel Across Activities

Nike+ uses algorithms to ensure that NikeFuel values are accurate for every user regardless of the number of different Activities, devices, or apps the user might use each day. These algorithms provide a user’s NikeFuel across Activities and remove duplicate (“dedupe”) NikeFuel if Activities receive data from multiple devices or apps. Providing deduped NikeFuel across Activities is essential to maintaining an authentic Nike+ experience.

Making deduped NikeFuel available across Activities is a new Nike+ service that ensures an authentic experience for the user. Prior to this, a user might get duplicate NikeFuel for overlapping Activities.

For example, a user might begin the day wearing an all-day device (e.g., Nike+ FuelBand), go for a run with the all-day device and two different running apps, and later take a bike ride with the all-day device and a watch app. Prior to Nike+ making deduped NikeFuel across Activities available, the user, in this case, would have five NikeFuel values associated with the run and cycle workouts. Getting the total NikeFuel generated by these Activities would be difficult if you had to derive it from each Activity and eliminate any duplication over a particular interval. Nike+ solves this by providing deduped NikeFuel values across Activities via the ALL_DAY Activity Type.

THE ALL_DAY ACTIVITY TYPE

The ALL_DAY Activity Type provides developers with one view of NikeFuel for a Nike+ user across Activities and without any duplication of NikeFuel values. This is useful when developers want devices or apps to receive NikeFuel from Nike+ without having to check the NikeFuel for each Activity or verify that there are no duplicate NikeFuel values.

The ALL_DAY Activity Type always has the day’s deduped NikeFuel across Activities in metricSummary.fuel. The startTime field for an ALL_DAY Activity will always be the start of the day and the activityTimeZone field will always be the time zone of the user. The status field for an ALL_DAY Activity will always be “NONE.”

The value of the other metricSummary fields (calories, distance, steps, and duration) will depend on whether the user is using an all-day device (e.g., Nike+ FuelBand). If the user is using an all-day device, these fields and the deviceType field will be associated with it. If the user is not using an all-day device, these fields will be “0” and the deviceType field will indicate the device used to submit the first Activity of the day for the user.  

The following are two examples of the ALL_DAY Activity Type section in the response body returned from a GET to the List Activities endpoint:

EXAMPLE 1 (NO ALL-DAY DEVICE)

Below is the ALL_DAY Activity Type section for a user who is not wearing an all-day device and goes for a run with a running app. Notice that the metricSummary fields (other than metricSummary.fuel) are “0” because an all-day device was not used. The startTime field has the start of the day rather than the start of the RUN Activity. The deviceType is the device associated with the RUN Activity.
{
    "links"  
    [
        {
             "rel": "self",
             "href": "https  //api.stage.nike.com/me/sport/activities/cfe6cc82-59dd-414a-9044-9217c2690c8c"
        }
    ],
    "activityId": "cfe6cc82-59dd-414a-9044-9217c2690c8c",
    "activityType": "ALL_DAY",
    "startTime": "2014-01-07T08:00:00Z",
    "activityTimeZone": "America/Los_Angeles",
    "status": "NONE",
    "deviceType": "PHONE",
    "metricSummary"  
    {
        "calories": "0",
        "fuel": "81",
        "distance": "0.0",
        "steps": "0",
        "duration": "0:00:00.000"
    },
    "tags" [],
    "metrics" []
}

EXAMPLE 2 (ALL-DAY DEVICE)

Below is the ALL_DAY Activity Type section for a user who begins the day wearing an all-day device and later that day goes for a run with a running app. The metricSummary.fuel field is the deduped NikeFuel (see DEDUPED NIKEFUEL AND THE ALL_DAY ACTIVITY TYPE below). The other metricSummary fields (calories, distance, steps, and duration) are associated with the all-day device. The startTime field has the start of the day. The deviceType is the device associated with the ALL_DAY Activity device.
{
    "links"  
    [
        {
             "rel": "self",
             "href": "https  //api.stage.nike.com/me/sport/activities/78c2d0c0-cc8d-439d-8a86-a72b11bf2143"
        }
    ],
    "activityId": "78c2d0c0-cc8d-439d-8a86-a72b11bf2143",
    "activityType": "ALL_DAY",
    "startTime": "2014-01-07T08:00:00Z",
    "activityTimeZone": "America/Los_Angeles",
    "status": "NONE",
    "deviceType": "FUELBAND",
    "metricSummary"  
    {
        "calories": "198",
        "fuel": "681",
        "distance": "1.5732252",
        "steps": "1998",
        "duration": "0:06:00.000"
    },
    "tags" [],
    "metrics" []
}

DEDUPED NIKEFUEL AND THE ALL_DAY ACTIVITY TYPE

When multiple Activities generate NikeFuel over the same time interval, Nike+ will dedupe the NikeFuel by removing any duplicate NikeFuel values from Activities and assigning an appropriate NikeFuel value to each Activity. If the values of the duplicate NikeFuel for an Activity are different, Nike+ will assign the highest NikeFuel to the Activity.

For example, a user might begin the day wearing an all-day device (e.g., Nike+ FuelBand), go for a run with the all-day device and two different running apps, and later take a bike ride with the all-day device and a watch app. When Activities overlap like this, Nike+ will eliminate duplicate NikeFuel values and assign the correct NikeFuel value to the Activity. This deduped NikeFuel value across Activities is available in metricSummary.fuel of the ALL_DAY Activity Type.

DedupeGraphic3

Note:  The metricSummary.fuel in the ALL_DAY Activity Type will provide deduped NikeFuel across Activities beginning December 10, 2014. NikeFuel earned prior to this date will not be deduped. Any Activity submitted after this date will be deduped regardless of the date of the Activity.

 

 

GETTING THE ALL_DAY ACTIVITY TYPE

The value of metricSummary.fuel in the ALL_DAY Activity Type section is always the total deduped NikeFuel across all Activities for the day. The ALL_DAY Activity Type is available from the following GET endpoints:

Note:  See the Activity Detail, List Activities, or List Activities by Experience Type endpoints for general request and response examples. What follows is specific to the ALL_DAY Activity Type section in the response body returned by these endpoints.

LIST ACTIVITIES: ALL_DAY ACTIVITY TYPE

Use the List Activities endpoint to get the ALL_DAY Activity Type and its metricSummary.fuel value along with any other Activity Types for each day. You can also use the List Activities endpoint to get the activityId of the ALL_DAY Activity Type. You can then use the activityId of the ALL_DAY Activity Type with the Activity Detail endpoint to get additional ALL_DAY Activity data (see ACTIVITY DETAIL: ALL_DAY ACTIVITY TYPE below for more information).

SAMPLE REQUEST

See List Activities for more information on request parameters.
GEThttps://api.nike.com/v1/me/sport/activities?access_token={access_token}

SAMPLE RESPONSE BODY

The following is an example of the ALL_DAY Activity Type included in every response body from a request to the List Activities endpoint. In this example, the user goes for a run with a running app while wearing an all-day device. So the response body also includes a RUN Activity Type along with the ALL_DAY Activity Type for the same day. The value of metricSummary.fuel in the ALL_DAY Activity Type section will always be the total deduped NikeFuel across Activities for the day (see THE ALL_DAY ACTIVITY TYPE for information on field values other than metricSummary.fuel).

See List Activities for general information on response body fields.

{
    "links"  
    [
        {
                "rel": "self",
                "href": "https://api.nike.com/v1/me/sport/activities /5370000000020468273910014878462942873543"
        }
    ],
    "activityId": "5370000000020468273910014878462942873543",
    "activityType": "RUN",
    "startTime": "2014-01-07T20:30:44Z ",
    "activityTimeZone": "America/Los_Angeles",
    "status": "COMPLETE",
    "deviceType": "PHONE",
    "metricSummary"  
    {
        "calories": "600",
        "fuel": "81",
        "distance": "1.8",
        "steps": "550",
        "duration": "0:00:50.000"
    },
    "tags" [],
    "metrics" []
},
{
    "links"  
    [
        {
                "rel": "self",
                "href": "https://api.nike.com/v1/me/sport/activities/78c2d0c0-cc8d-439d-8a86-a72b11bf2143"
        }
    ],
    "activityId": "78c2d0c0-cc8d-439d-8a86-a72b11bf2143",
    "activityType": "ALL_DAY",
    "startTime": "2014-01-07T08:00:00Z",
    "activityTimeZone": "America/Los_Angeles",
    "status": "NONE",
    "deviceType": "FUELBAND",
    "metricSummary"  
    {
        "calories": "198",
        "fuel": "681",
        "distance": "1.5732252",
        "steps": "1998",
        "duration": "0:06:00.000"
    },
    "tags" [],
    "metrics"  []
}

ACTIVITY DETAILS: ALL_DAY ACTIVITY TYPE

SAMPLE REQUEST

Use the Activity Detail endpoint to receive details (e.g., values for metrics every minute) for the ALL_DAY Activity Type. Use the activityId of the ALL_DAY Activity Type (see LIST ACTIVITIES: ALL_DAY ACTIVITY TYPE for information about how to get the activityId ) to obtain details of the Activity. See Activity Detail for more information on request parameters.
GEThttps://api.nike.com/v1/me/sport/activities/f8e273b7-d88c-4823-9c96-307d323bd70c?access_token={access_token}

SAMPLE RESPONSE BODY

The following is an example of an ALL_DAY Activity Type in the response body from a request to the Activity Detail endpoint. The value of metricSummary.fuel will always be the current total deduped NikeFuel across Activities for the day (see THE ALL_DAY ACTIVITY TYPE for information on field values other than metricSummary.fuel).

See Activity Detail for general information on response body fields.

Note:  The below sample code is truncated and only shows the first three values for each metricType since the metrics array of an ALL_DAY Activity Type includes data for the entire day (i.e., 1,440 entries for each minute of the day) in the values array for each metricType.

{
    "links": [
        {
            "rel": "self",
            "href": "https://api.nike.com/v1/me/sport/activities/f8e273b7-d88c-4823-9c96-307d323bd70c"
        }
    ],
    "activityId": "f8e273b7-d88c-4823-9c96-307d323bd70c",
    "activityType": "ALL_DAY",
    "startTime": "2014-01-07T08:00:00Z",
    "activityTimeZone": "America/Los_Angeles",
    "status": "NONE",
    "deviceType": "FUELBAND",
    "metricSummary": {
        "calories": "198",
        "fuel": "681",
        "distance": "1.5732252",
        "steps": "1998",
        "duration": "0:06:00.000"
    },
    "tags": [],
    "metrics": [
        {
            "intervalMetric": 1,
            "intervalUnit": "MIN",
            "metricType": "STARS",
            "values": [
                "0",
                "0",
                "0",
                "0",
                
            ]
        },
        {
            "intervalMetric": 1,
            "intervalUnit": "MIN",
            "metricType": "CALORIES",
            "values": [
                "0",
                "0",
                "0",
                
            ]
        },
        {
            "intervalMetric": 1,
            "intervalUnit": "MIN",
            "metricType": "STEPS",
            "values": [
                "0",
                "0",
                "0",
                
            ]
        },
        {
            "intervalMetric": 1,
            "intervalUnit": "MIN",
            "metricType": "FUEL",
            "values": [
                "0",
                "0",
                "0",
                
            ]
        }
    ],
    "isGpsActivity": false
}

LIST ACTIVITIES BY EXPERIENCE TYPE: ALL_DAY ACTIVITY TYPE

SAMPLE REQUEST

Use the List Activities by Experience Type endpoint and the FUELBAND Experience Type filter to list ALL_DAY Activities for a specified number of days. This is useful if you want deduped NikeFuel across Activities for more than one day.
GEThttps://api.nike.com/v1/me/sport/activities/FUELBAND?access_token={access_token}

SAMPLE RESPONSE BODY

The following is an example of ALL_DAY Activities that will appear in a response body from a request to the List Activities by Experience Type endpoint with the FUELBAND Experience Type filter. The value of metricSummary.fuel will be the total deduped NikeFuel across Activities for each day (see THE ALL_DAY ACTIVITY TYPE for information on field values other than metricSummary.fuel).

See List Activities by Experience Type for general information on response body fields.

{
  "data": [
    {
      "links": [
        {
          "rel": "self",
          "href": "https://api.nike.com/v1/me/sport/activities/8244e0d3-8f1a-4ee4-8e98-50166398fdfc"
        }
      ],
      "activityId": "8244e0d3-8f1a-4ee4-8e98-50166398fdfc",
      "activityType": "ALL_DAY",
      "startTime": "2014-12-02T08:00:00Z",
      "activityTimeZone": "America/Los_Angeles",
      "status": "NONE",
      "deviceType": "FUELBAND",
      "metricSummary": {
        "calories": "670",
        "fuel": "2000",
        "distance": "5.251957999999999",
        "steps": "6670",
        "duration": "0:10:00.000"
      },
      "tags": [],
      "metrics": []
    },
    {
      "links": [
        {
          "rel": "self",
          "href": "https://api.nike.com/v1/me/sport/activities/942a3812-745b-444e-ac1d-19068a71dc0f"
        }
      ],
      "activityId": "942a3812-745b-444e-ac1d-19068a71dc0f",
      "activityType": "ALL_DAY",
      "startTime": "2014-12-01T08:00:00Z",
      "activityTimeZone": "America/Los_Angeles",
      "status": "NONE",
      "deviceType": "FUELBAND",
      "metricSummary": {
        "calories": "670",
        "fuel": "2000",
        "distance": "5.251957999999999",
        "steps": "6670",
        "duration": "0:10:00.000"
      },
      "tags": [],
      "metrics": []
    },
    {
      "links": [
        {
          "rel": "self",
          "href": "https://api.nike.com/v1/me/sport/activities/9ce3efaa-fa43-4403-89fb-3f5da0936889"
        }
      ],
      "activityId": "9ce3efaa-fa43-4403-89fb-3f5da0936889",
      "activityType": "ALL_DAY",
      "startTime": "2014-07-04T07:00:00Z",
      "activityTimeZone": "America/Los_Angeles",
      "status": "NONE",
      "deviceType": "WATCH",
      "metricSummary": {
        "calories": "0",
        "fuel": "1212",
        "distance": "0.0",
        "steps": "0",
        "duration": "0:00:00.000"
      },
      "tags": [],
      "metrics": []
    }
  ],
  "paging": {
    "next": "/v1/me/sport/activities/FUELBAND?count=90&access_token={access_token}&offset=6",
    "previous": null
  }
}

USE CASES: DERIVING NIKEFUEL FROM ALL_DAY ACTIVITY TYPE

TWO ACTIVITIES: RUN AND CYCLE

A user goes for a run with an app that submits a RUN Activity Type. Since this is the first Activity submitted for this user for the day, Nike+ creates an ALL_DAY Activity for the user along with the RUN Activity. Nike+ updates the RUN and ALL_DAY Activities with NikeFuel. The user finishes the run. The user then goes for a bike ride with a device that submits a CYCLE Activity Type. Nike+ creates the CYCLE Activity. Nike+ updates the CYCLE Activity and the ALL_DAY Activity to include the NikeFuel generated by the bike ride.

The user would like the total NikeFuel at the end of the bike ride. The app can display this to the user by acquiring the list of Activities for the day from a GET to the List Activities endpoint. The value of metricSummary.fuel in the ALL_DAY Activity Type section will be the total NikeFuel generated by both the RUN and CYCLE Activities.

ALL-DAY DEVICE WITH TWO ACTIVITIES: RUN AND CYCLE

A user begins the day wearing an all-day device (e.g., Nike+ FuelBand). The all-day device submits an ALL_DAY Activity Type and Nike+ creates an ALL_DAY Activity for the user. The user then goes for a run with the all-day device and a running app. The running app submits a RUN Activity Type to Nike+ and Nike+ creates a RUN Activity. Nike+ updates the RUN and ALL_DAY Activities with NikeFuel and dedupes any NikeFuel generated over the same period of time by these Activities. The user then goes for a bike ride with the all-day device and a watch app. The watch app submits a CYCLE Activity Type to Nike+ and Nike+ creates a CYCLE Activity Type. Nike+ updates the CYCLE and ALL_DAY Activities with NikeFuel and dedupes any NikeFuel generated over the same period of time by these Activities.

The user would like the total NikeFuel at the end of the bike ride. The app can display this to the user by acquiring the list of Activities for the day from a GET to the List Activities endpoint. The value of metricSummary.fuel in the ALL_DAY Activity Type section will be the total deduped NikeFuel associated with the all-day device and the RUN and CYCLE Activities.