Adds a SamplePoint to a SampleSet under a specified dataCollector. The SampleSet does not need to be created in advance.
| Protocol | HTTPS PATCH |
|---|---|
| Direction | App > Health Service Kit cloud |
| URL | https://health-api.cloud.huawei.com/healthkit/v2/dataCollectors/{dataCollectorId}/sampleSets/{sampleSetId} |
| Data Format | Request: Content-Type: application/json Response: Content-Type: application/json |
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| dataCollectorId | String | Yes | Unique ID of the data collector. |
| sampleSetId | String | Yes | ID of the sampling dataset (in nanoseconds). The format must be startTime-endTime, where the startTime/endTime must be a 19-digit integer timestamp, ranging from 2000-01-01 00:00:00 to 2099-12-31 23:59:59. |
Request Header
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| Content-type | String | Yes | Value: application/json; charset=UTF-8 |
| Authorization | String | Yes | For details, see Authentication. NOTE: A space character must be added between Bearer and the value of access_token. |
| x-client-id | String | No | App ID allocated by HUAWEI Developers. The server can perform gray routing based on this parameter. It is recommended that this parameter be carried. |
| x-version | String | No | Software version number of the app calling the API, that is, the version number of the current client. The server can perform gray release based on this parameter. It is recommended that this parameter be carried. |
| x-caller-trace-id | String | No | Request tracing ID, which is used to connect the entire request chain between the service calling party and server. It is recommended that this parameter be carried. |
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| dataCollectorId | String | Yes | Unique ID of the data collector. The dataCollectorId value must be the same in the input parameters and request body. |
| startTime | Long | Yes | Minimum start time among all sampling points, in nanoseconds. |
| endTime | Long | Yes | Maximum end time among all sampling points, in nanoseconds. |
| samplePoints | List<SamplePoint> | Yes | SamplePoint list. A maximum of 1000 SamplePoint objects can be uploaded for each patch operation. For details, please refer to SamplePoint. |
| timeZone | String | Yes | Time zone information. Example: +0800 |
PATCH
https://health-api.cloud.huawei.com /healthkit/v2/dataCollectors/cmF3OmNvbnRpbnVvdXMuY2Fsb3JpZXMuYnVybnQEwMTI3ODUwMTpqEF7rB3uBcGykpv6T2TisfTMhfZAvz1BP2Kcz70d1Sg/sampleSets/1567267200000000000-1567440000000000000
Content-Type: application/json
Authorization: Bearer ***
x-client-id: ***
x-version: ***
x-caller-trace-id: ***
{
"dataCollectorId": "cmF3OmNvbnRpbnVvdXMuY2Fsb3JpZXMuYnVybnQEwMTI3ODUwMTpqEF7rB3uBcGykpv6T2TisfTMhfZAvz1BP2Kcz70d1Sg",
"startTime": 1567267200000000000,
"endTime": 1567440000000000000,
"timeZone": "+0800",
"samplePoints": [
{
"dataTypeName": "com.huawei.continuous.calories.burnt",
"endTime": 1567310400000000000,
"startTime": 1567267200000000000,
"value": [
{
"fieldName": "calories",
"floatValue": 3
}
]
}
]
} When the status code is 200:
Response Header
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| Content-Type | String | Yes | Value: application/json; charset=UTF-8 |
Response Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| startTime | Long | Yes | Minimum start time among all sampling points, in nanoseconds. |
| endTime | Long | Yes | Maximum end time among all sampling points, in nanoseconds. |
| dataCollectorId | String | Yes | Unique ID of the data collector. The dataCollectorId value must be the same in the input parameters and request body. |
| samplePoints | List<SamplePoint> | Yes | SamplePoint list. For details, please refer to SamplePoint. |
HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
{
"startTime": 1567267200000000000,
"endTime": 1567440000000000000,
"timeZone": "+0800",
"dataCollectorId": "cmF3OmNvbnRpbnVvdXMuY2Fsb3JpZXMuYnVybnQEwMTI3ODUwMTpqEF7rB3uBcGykpv6T2TisfTMhfZAvz1BP2Kcz70d1Sg",
"samplePoints": [
{
"startTime": 1567267200000000000,
"endTime": 1567310400000000000,
"dataTypeName": "com.huawei.continuous.calories.burnt",
"value": [
{
"fieldName": "calories",
"floatValue": 3
}
]
}
]
}