Skip to main content

Health Service

Health service will handle all the health-related services.

Endpoints

# Endpoints


Get pointer

This endpoint get user's last step pointer

Request (StepPointerReqDTO)

POST /steps/sync
{
"userId": "user-1"
}

Response (StepPointerResDTO)

{
"success": true,
"message": "",
"data": {
"pointer": "2025-04-02T16:00:00.000Z"
}
}

Sync step

This endpoint synchronizes user's steps.

Request (UpdateStepDTO)

POST /steps/sync
{
"data": [
{
"userId": "user-1",
"startTime": "2024-06-07T09:38:07.000Z",
"endTime": "2024-06-07T10:38:07.000Z",
"steps": 376,
"birthdate": "1993-04-09",
"height": 172,
"weight": 65.2
}
]
}

Response

{
"success": true,
"message": "",
"data": null
}

Adjust step

This endpoint synchronizes user's steps.

Request (UpdateStepDTO)

POST /steps/adjust
{
"data": [
{
"userId": "user-1",
"startTime": "2024-06-07T09:38:07.000Z",
"endTime": "2024-06-07T10:38:07.000Z",
"steps": 376,
"birthdate": "1993-04-09",
"height": 172,
"weight": 65.2
}
]
}

Response

{
"success": true,
"message": "",
"data": null
}

Fetch step

This endpoint fetches user's steps.

Request (FetchStepReqDTO)

POST /steps/fetch
{
"userId": "user-1",
"mode": 3,
"fillMode": false,
"startTime": "2024-05-10T16:00:00.000Z",
"endTime": "2024-07-15T08:00:00.000Z"
}

Response (FetchStepResDTO)

mode = 1

{
"success": true,
"message": "",
"data": {
"total": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"rows": [
{
"startTime": "2024-06-07 08:00:00",
"endTime": "2024-06-07 09:00:00",
"steps": 328,
"distance": 233,
"calories": 15
}
],
"isFullDay": false
}
}

mode = 2

{
"success": true,
"message": "",
"data": {
"total": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"dailyAverage": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"rows": [
{
"date": "2024-06-07",
"steps": 1274,
"distance": 906,
"calories": 59
}
]
}
}

mode = 3

{
"success": true,
"message": "",
"data": {
"total": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"dailyAverage": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"rows": [
{
"month": "2024-06",
"steps": 328,
"distance": 233,
"calories": 15
}
]
}
}

Fetch user last activity

This endpoint returns the users' id for those whose last activity is before the specific number of days before today.

Request (FetchUserLastActivityReqDTO)

POST /steps/user-last-activity
{
"userIds": [
"user-1"
],
"gt": 3
}

Response (FetchUserLastActivityResDTO)

{
"success": true,
"message": "",
"data": [
"userId1",
"userId2"
]
}

Sync step v2

This endpoint synchronizes user's steps.

Request (UpdateStepV2DTO)

POST /steps/sync
{
"dataOrigins": [
"IOS"
],
"dataOrigin": "IOS",
"userId": "user-1",
"birthdate": "1993-04-09",
"height": 172,
"weight": 65.2,
"data": [
{
"startTime": "2024-06-07T09:38:07.000Z",
"endTime": "2024-06-07T10:38:07.000Z",
"steps": 376
}
]
}

Response

{
"success": true,
"message": "",
"data": null
}

Adjust step v2

This endpoint synchronizes user's steps.

Request (UpdateStepDTO)

POST /steps/adjust
{
"data": [
{
"userId": "user-1",
"startTime": "2024-06-07T09:38:07.000Z",
"endTime": "2024-06-07T10:38:07.000Z",
"steps": 376,
"birthdate": "1993-04-09",
"height": 172,
"weight": 65.2
}
]
}

Response

{
"success": true,
"message": "",
"data": null
}

Fetch step v2

This endpoint fetches user's steps.

Request (FetchStepReqDTO)

POST /steps/fetch
{
"userId": "user-1",
"mode": 3,
"fillMode": false,
"startTime": "2024-05-10T16:00:00.000Z",
"endTime": "2024-07-15T08:00:00.000Z"
}

Response (FetchStepResDTO)

mode = 1

{
"success": true,
"message": "",
"data": {
"total": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"rows": [
{
"startTime": "2024-06-07 08:00:00",
"endTime": "2024-06-07 09:00:00",
"steps": 328,
"distance": 233,
"calories": 15
}
],
"isFullDay": false
}
}

mode = 2

{
"success": true,
"message": "",
"data": {
"total": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"dailyAverage": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"rows": [
{
"date": "2024-06-07",
"steps": 1274,
"distance": 906,
"calories": 59
}
]
}
}

mode = 3

{
"success": true,
"message": "",
"data": {
"total": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"dailyAverage": {
"steps": 1274,
"distance": 906,
"calories": 59
},
"rows": [
{
"month": "2024-06",
"steps": 328,
"distance": 233,
"calories": 15
}
]
}
}

Fetch user last activity v2

This endpoint returns the users' id for those whose last activity is before the specific number of days before today.

Request (FetchUserLastActivityReqDTO)

POST /steps/user-last-activity
{
"userIds": [
"user-1"
],
"gt": 3
}

Response (FetchUserLastActivityResDTO)

{
"success": true,
"message": "",
"data": [
"userId1",
"userId2"
]
}


Resources

StepPointerReqDTO

properties
  • userId
    string
    required
    The id of the user.

StepPointerResDTO

properties
  • pointer
    string
    required
    The last step time of the user.

UpdateStepDTO

properties
  • data
    UpdateStepDTO[]
    A list of step entities.

UpdateStepItemDTO

properties
  • userId
    string
    required
    The id of the user.
  • startTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The start time.
  • endTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The end time.
  • steps
    number
    required
    The step count of the user.
  • birthdate
    string
    required
    The id of the user.
  • height
    number
    required
    The height of the user.
  • weight
    number
    required
    The weight of the user.

UpdateStepV2DTO

properties
  • dataOrigins
    array
    required
    All data sources reported from the APP.
  • dataOrigin
    string
    required
    The chosen data source reported from the APP.
  • userId
    string
    required
    The id of the user.
  • birthdate
    string
    required
    The id of the user.
  • height
    number
    required
    The height of the user.
  • weight
    number
    required
    The weight of the user.
  • data
    UpdateStepV2DTO[]
    A list of step entities.

UpdateStepItemV2DTO

properties
  • userId
    string
    required
    The id of the user.
  • startTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The start time.
  • endTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The end time.
  • steps
    number
    required
    The step count of the user.
  • birthdate
    string
    required
    The id of the user.
  • height
    number
    required
    The height of the user.
  • weight
    number
    required
    The weight of the user.

FetchStepReqDTO

properties
  • userId
    string
    required
    The id of the user.
  • mode
    FetchMode
    required
    The fetch mode of the request.
  • fillMode
    boolean
    default:  
    If fillMode = True, it will fill in all the entries; otherwise, it will only return the existing entry.
  • startTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The start time.
  • endTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The end time.

FetchStepResDTO

properties
  • total
    StepTotalDTO
    The summary of the steps over the period.
  • The summary of the daily average information over the period. It is only available for the mode = 2 or mode = 3.
  • The step entity.
  • isFullDay
    boolean
    If the current data source is Samsung Health, it will be True; otherwise, it is False

StepTotalDTO

properties
  • steps
    number
    required
    The total step count over the period.
  • distance
    number
    required
    The total distance over the period.
  • calories
    number
    required
    The total calories over the period.

StepDailyAverageDTO

properties
  • steps
    number
    required
    The daily average of the step count over the period.
  • distance
    number
    required
    The daily average of the distance over the period.
  • calories
    number
    required
    The daily average of the calories over the period.

StepHourlyItemDTO

properties
  • startTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The start time.
  • endTime
    datetime
    required
    YYYY-MM-DDThh:mm:ss.000Z
    The end time.
  • steps
    number
    required
    The step count of the user.
  • distance
    number
    required
    The distance of the user.
  • calories
    number
    required
    The calories of the user.

StepDailyItemDTO

properties
  • date
    datetime
    YYYY-MM-DD
    The date for the statistics.
  • steps
    number
    The step count of the user.
  • distance
    number
    The distance of the user.
  • calories
    number
    The calories of the user.

StepMonthlyItemDTO

properties
  • month
    string
    required
    YYYY-MM
    The month of the statistics.
  • steps
    number
    required
    The step count of the user.
  • distance
    number
    required
    The distance of the user.
  • calories
    number
    required
    The calories of the user.

FetchUserLastActivityReqDTO

properties
  • userIds
    string
    required
    The list of the users' id.
  • gt
    number
    required
    The number of day before today.

FetchUserLastActivityResDTO

properties
  • data
    list
    required
    The list of the users' id.


FetchMode

NameValue
Hourly1
Daily2
Monthly3