GET api/devices/fitness/{id}/sleep?fromDate={fromDate}&toDate={toDate}&did={did}

Sleep data from user fitness devices

Request Information

URI Parameters

NameDescriptionTypeAdditional information
id

object representing logged in userid that need to get fitness data.

integer

Required

fromDate

object representing start datetime to get fitness data.

decimal number

Required

toDate

object representing end datetime to get fitness data.

decimal number

None.

did

object representing device id that need to fitness data.

string

None.

Body Parameters

None.

Response Information

Resource Description

On success, return sleep data On failure, return null

SleepActivityResp
NameDescriptionTypeAdditional information
sleep_activity

sleep activity data from selected date

Collection of SleepActivity

None.

resp_code

Lifetrons response code

string

None.

resp_msg

Lifetrons response message

string

None.

Response Formats

application/json, text/json

Sample:
{
  "sleep_activity": [
    {
      "log_id": "sample string 1",
      "deep": 2,
      "light": 3,
      "awake": 4,
      "rem": 5,
      "bed_time": 6.1,
      "wakeup_time": 7.1,
      "is_uploaded": 8,
      "data": [
        {
          "id": 1,
          "log_id": "sample string 2",
          "type": "sample string 3",
          "start_time": 4.1,
          "end_time": 5.1,
          "is_uploaded": 6
        },
        {
          "id": 1,
          "log_id": "sample string 2",
          "type": "sample string 3",
          "start_time": 4.1,
          "end_time": 5.1,
          "is_uploaded": 6
        }
      ]
    },
    {
      "log_id": "sample string 1",
      "deep": 2,
      "light": 3,
      "awake": 4,
      "rem": 5,
      "bed_time": 6.1,
      "wakeup_time": 7.1,
      "is_uploaded": 8,
      "data": [
        {
          "id": 1,
          "log_id": "sample string 2",
          "type": "sample string 3",
          "start_time": 4.1,
          "end_time": 5.1,
          "is_uploaded": 6
        },
        {
          "id": 1,
          "log_id": "sample string 2",
          "type": "sample string 3",
          "start_time": 4.1,
          "end_time": 5.1,
          "is_uploaded": 6
        }
      ]
    }
  ],
  "resp_code": "sample string 1",
  "resp_msg": "sample string 2"
}

application/xml, text/xml

Sample:
<SleepActivityResp xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/LifetronsPhoneApi.Domain.ResponseAgg">
  <resp_code xmlns="http://schemas.datacontract.org/2004/07/LifetronsPhoneApi.Models">sample string 1</resp_code>
  <resp_msg xmlns="http://schemas.datacontract.org/2004/07/LifetronsPhoneApi.Models">sample string 2</resp_msg>
  <sleep_activity xmlns:d2p1="http://schemas.datacontract.org/2004/07/CommonClasses.devices">
    <d2p1:sleep_activity>
      <d2p1:awake>4</d2p1:awake>
      <d2p1:bed_time>6.1</d2p1:bed_time>
      <d2p1:data>
        <d2p1:sleep_data>
          <d2p1:end_time>5.1</d2p1:end_time>
          <d2p1:id>1</d2p1:id>
          <d2p1:is_uploaded>6</d2p1:is_uploaded>
          <d2p1:log_id>sample string 2</d2p1:log_id>
          <d2p1:start_time>4.1</d2p1:start_time>
          <d2p1:type>sample string 3</d2p1:type>
        </d2p1:sleep_data>
        <d2p1:sleep_data>
          <d2p1:end_time>5.1</d2p1:end_time>
          <d2p1:id>1</d2p1:id>
          <d2p1:is_uploaded>6</d2p1:is_uploaded>
          <d2p1:log_id>sample string 2</d2p1:log_id>
          <d2p1:start_time>4.1</d2p1:start_time>
          <d2p1:type>sample string 3</d2p1:type>
        </d2p1:sleep_data>
      </d2p1:data>
      <d2p1:deep>2</d2p1:deep>
      <d2p1:is_uploaded>8</d2p1:is_uploaded>
      <d2p1:light>3</d2p1:light>
      <d2p1:log_id>sample string 1</d2p1:log_id>
      <d2p1:rem>5</d2p1:rem>
      <d2p1:wakeup_time>7.1</d2p1:wakeup_time>
    </d2p1:sleep_activity>
    <d2p1:sleep_activity>
      <d2p1:awake>4</d2p1:awake>
      <d2p1:bed_time>6.1</d2p1:bed_time>
      <d2p1:data>
        <d2p1:sleep_data>
          <d2p1:end_time>5.1</d2p1:end_time>
          <d2p1:id>1</d2p1:id>
          <d2p1:is_uploaded>6</d2p1:is_uploaded>
          <d2p1:log_id>sample string 2</d2p1:log_id>
          <d2p1:start_time>4.1</d2p1:start_time>
          <d2p1:type>sample string 3</d2p1:type>
        </d2p1:sleep_data>
        <d2p1:sleep_data>
          <d2p1:end_time>5.1</d2p1:end_time>
          <d2p1:id>1</d2p1:id>
          <d2p1:is_uploaded>6</d2p1:is_uploaded>
          <d2p1:log_id>sample string 2</d2p1:log_id>
          <d2p1:start_time>4.1</d2p1:start_time>
          <d2p1:type>sample string 3</d2p1:type>
        </d2p1:sleep_data>
      </d2p1:data>
      <d2p1:deep>2</d2p1:deep>
      <d2p1:is_uploaded>8</d2p1:is_uploaded>
      <d2p1:light>3</d2p1:light>
      <d2p1:log_id>sample string 1</d2p1:log_id>
      <d2p1:rem>5</d2p1:rem>
      <d2p1:wakeup_time>7.1</d2p1:wakeup_time>
    </d2p1:sleep_activity>
  </sleep_activity>
</SleepActivityResp>