googleapis / googleapis/google-api-nodejs-client

400 ERR_BAD_REQUEST while fetching resting heart rate

Open
#3,111 0 comments 0 reactions 0 assignees View on GitHub
priority: p2 type: bug
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

I am trying to fetch **resting heart rate** where already I have enabled scope for it.
But I am getting 400 ERR_BAD_REQUEST on api request

**### Code**
```
await axios({
method: "POST",
headers: {
authorization: "Bearer " + accessToken,
"Content-Type": "application/json",
},
url: `https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate`,
data: {
"aggregateBy": [{
// dataTypeName: "com.google.heart_rate.summary",
dataTypeName: "derived:com.google.heart_rate.bpm:com.google.android.gms:resting_heart_rate<-merge_heart_rate_bpm"
}],
"startTimeMillis": startTimeMillis,
"endTimeMillis": endTimeMillis,
}
})
```

**Enabled Scopes**
`https://www.googleapis.com/auth/fitness.activity.read`
`https://www.googleapis.com/auth/fitness.body.read`

When I try to fetch data using both of them I am getting Error response.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.