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

HeartRate Time Series - Wrong format

ANSWERED

Hi guys,

 

I'm trying to get TIme series of my HR data. I have personal app for this.

 

When I'm requesting this endpoint: https://api.fitbit.com/1/user/-/activities/heart/date/2015-11-01/1d/1sec.json everything is OK.

 

When I request https://api.fitbit.com/1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00.json for some reason list of activities is returnerned.

 

And when I request https://api.fitbit.com/1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00/23:59.json API answer me that url is malformed. But accoring to DOC this should work.

 

Could anyone help me with this? What I'm doing wrong?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

@Fabulator wrote:

When I request https://api.fitbit.com/1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00.json for some reason list of activities is returnerned.


Our 404 handling on this path is not very good. The list of activities means that you've requested an invalid time series.

 

If you specify a start time, you must specify an end time. In this URL, you're missing the end time.

 


@Fabulator wrote:

 

And when I request https://api.fitbit.com/1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00/23:59.json API answer me that url is malformed. But accoring to DOC this should work.

 


This worked for me:

GET /1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00/23:59.json HTTP/1.1

HTTP/1.1 200 OK

Content-Language: en
Fitbit-Rate-Limit-Limit: 150
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Connection: keep-alive
Server: cloudflare-nginx
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Date: Wed, 25 Nov 2015 18:26:34 GMT
Transfer-Encoding: chunked
Fitbit-Rate-Limit-Remaining: 149
CF-RAY: 24af671191a423b4-IAD
Fitbit-Rate-Limit-Reset: 2007
Content-Type: application/json;charset=UTF-8

{
  "activities-heart": [
    {
      "customHeartRateZones": [],
      "dateTime": "2015-11-01",
      "heartRateZones": [],
      "value": "77.95"
    }
  ],
  "activities-heart-intraday": {
    "dataset": [
      {
        "time": "00:00:00",
        "value": 82
      },
      {
        "time": "00:00:15",
        "value": 82
      },
...
      {
        "time": "23:58:30",
        "value": 61
      },
      {
        "time": "23:58:40",
        "value": 62
      },
      {
        "time": "23:58:50",
        "value": 63
      }
    ],
    "datasetInterval": 1,
    "datasetType": "second"
  }
}

View best answer in original post

Best Answer
2 REPLIES 2

@Fabulator wrote:

When I request https://api.fitbit.com/1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00.json for some reason list of activities is returnerned.


Our 404 handling on this path is not very good. The list of activities means that you've requested an invalid time series.

 

If you specify a start time, you must specify an end time. In this URL, you're missing the end time.

 


@Fabulator wrote:

 

And when I request https://api.fitbit.com/1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00/23:59.json API answer me that url is malformed. But accoring to DOC this should work.

 


This worked for me:

GET /1/user/-/activities/heart/date/2015-11-01/1d/1sec/time/00:00/23:59.json HTTP/1.1

HTTP/1.1 200 OK

Content-Language: en
Fitbit-Rate-Limit-Limit: 150
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Connection: keep-alive
Server: cloudflare-nginx
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Date: Wed, 25 Nov 2015 18:26:34 GMT
Transfer-Encoding: chunked
Fitbit-Rate-Limit-Remaining: 149
CF-RAY: 24af671191a423b4-IAD
Fitbit-Rate-Limit-Reset: 2007
Content-Type: application/json;charset=UTF-8

{
  "activities-heart": [
    {
      "customHeartRateZones": [],
      "dateTime": "2015-11-01",
      "heartRateZones": [],
      "value": "77.95"
    }
  ],
  "activities-heart-intraday": {
    "dataset": [
      {
        "time": "00:00:00",
        "value": 82
      },
      {
        "time": "00:00:15",
        "value": 82
      },
...
      {
        "time": "23:58:30",
        "value": 61
      },
      {
        "time": "23:58:40",
        "value": 62
      },
      {
        "time": "23:58:50",
        "value": 63
      }
    ],
    "datasetInterval": 1,
    "datasetType": "second"
  }
}
Best Answer

Thanks for answer. Problem was with my library that is making API request. I could not send request with ':' in URL.

Best Answer