Sending Users Data

Use /samples endpoint to sync users' data with our API. You will need to split data points (samples) into batches of 1000 elements in size. It's okay to send such batches in parallel. Considering that you'll be sending us numerous batches, we recommend that you create a system to track samples that have already been submitted. As an example, the simplest method to accomplish this is by sending batches in chronological order and keeping a record of the most recent synchronized batch for each device.

POST /api/v1.1/samples

Headers

Name
Type
Description

Authorization*

String

Bearer <token>

Content-Type*

String

application/json

Request Body

Name
Type
Description

data_type*

String

Samples type. Either steps or bpm (for heart rate)

data*

Sample[]

An array of samples like heart rate measurements or steps. The minimal accepted size is 3 elements. The maximum accepted size is 1000 elements.

Each Sample in the data field must follow the following structure:

Field
Type
Description

device_name*

String

A unique device name like iPhone or Apple Watch

device_version

String

The version of the device or firmware

start_date*

String

Sample's start timestamp in ISO 8601 format

end_date

String

Sample's end timestamp in ISO 8601 format. It must not be earlier than start_date

unit*

String

Sample's unit. Either count, count/min, or count/s

value*

Number

Sample's value. It must be bigger than 0. It must be less than or equal to 30000 when unit is count. It must be less than or equal to 300 when unit is count/min.

REQUEST (EXAMPLE)
curl -X 'POST' 'https://<api-proxy-hostname>/api/v1.1/samples' \
     -H 'Authorization: Bearer <token>' \
     -H 'Content-Type: application/json' \
     -d '{
       "data_type": "steps",
       "data": [
         {
           "device_name": "iPhone",
           "device_version": "17.0.3",
           "start_date": "2023-11-01T08:04:51.000+04:00",
           "end_date": "2023-11-01T08:04:58.000+04:00",
           "value": 14,
           "unit": "count"
         },
         {
           "device_name": "iPhone",
           "device_version": "17.0.3",
           "start_date": "2023-11-01T09:47:21.000+04:00",
           "end_date": "2023-11-01T09:47:34.000+04:00",
           "value": 24,
           "unit": "count"
         },
         ...
       ]
     }'     

See the full example in the json-file below:

Last updated