saveBloodPressureData(params: Object)

Requires:
HealthKit≥5.18.0@ray-js/ray≥1.6.17
Platforms:
iOS
import { health } from '@ray-js/ray';

const { saveBloodPressureData } = health;

// Promise usage
try {
  const res = await saveBloodPressureData({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Write blood pressure data (systolic, diastolic, and start/end times) [iOS only]

Parameters

PropertyTypeRequiredDescription
systolicnumberYesSystolic
diastolicnumberYesDiastolic
startTimenumberYesStart time, timestamp in seconds
endTimenumberYesEnd time, timestamp in seconds
complete() => voidNoCompletion callback (executed on both success and failure)
success() => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Error Code

Error CodeError Message
1AppleHealthParamsError
2AppleHealthNoPermission

Examples

Write blood pressure data

import { health } from '@ray-js/ray'

const endTime = Math.floor(Date.now() / 1000);
const startTime = endTime - 60;

health.saveBloodPressureData({
  systolic: 120,
  diastolic: 80,
  startTime,
  endTime,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});