POST api/devices/fitness/sync/sleep/{id}

Sync sleep data from fitness devices to Lifetrons server

Request Information

URI Parameters

NameDescriptionTypeAdditional information
id

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

integer

Required

Body Parameters

object representing sleep data that need sync.

SleepActivityReq
NameDescriptionTypeAdditional information
Lifetrons_device_id

Lifetrons device id created by Lifetrons

string

None.

sleep_activity

sleep activity data

Collection of SleepActivity

Required

Request Formats

application/json, text/json

Sample:
{
  "Lifetrons_device_id": "sample string 1",
  "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
        }
      ]
    }
  ]
}

application/xml, text/xml

Sample:
<SleepActivityReq xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/LifetronsPhoneApi.Domain.RequestAgg">
  <Lifetrons_device_id>sample string 1</Lifetrons_device_id>
  <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>
</SleepActivityReq>

application/x-www-form-urlencoded

Sample:

Sample not available.

Response Information

Resource Description

On success, return Lifetrons response codes On failure, return Lifetrons response codes

DeviceDataResp
NameDescriptionTypeAdditional information
device

device id for any request or response

Lifetrons_device

None.

resp_code

Lifetrons response code

string

None.

resp_msg

Lifetrons response message

string

None.

Response Formats

application/json, text/json

Sample:
{
  "device": {
    "Lifetrons_device_id": "sample string 1",
    "device_id": "sample string 2"
  },
  "resp_code": "sample string 1",
  "resp_msg": "sample string 2"
}

application/xml, text/xml

Sample:
<device_data_resp 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>
  <device xmlns:d2p1="http://schemas.datacontract.org/2004/07/LifetronsPhoneApi.Domain.DeviceAgg">
    <d2p1:Lifetrons_device_id>sample string 1</d2p1:Lifetrons_device_id>
    <d2p1:device_id>sample string 2</d2p1:device_id>
  </device>
</device_data_resp>