尝试获取 API 以从 google 适合读取睡眠数据但返回 400 错误请求作为响应

Trying to GET API for Read Sleep Data from google fit but returning 400 Bad request in response

下面是我在 Google Playground 上传递的请求以及尝试通过代码获取访问令牌和更多数据的请求。此处使用的范围:https://www.googleapis.com/auth/fitness.activity.read

GET /fitness/v1/users/me/sessions?startTime=2019-12-05T00:00.000Z&endTime=2019-12-17T23:59:59.999Z&activityType=72 HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: Bearer Auth_code

您的开始时间格式不正确:

startTime=2019-12-05T00:00.000Z

您需要时、分、秒:

startTime=2019-12-05T00:00:00.000Z

OAuth 游乐场中的请求:

GET /fitness/v1/users/me/sessions?startTime=2019-12-05T00:00:00.000Z&endTime=2019-12-17T23:59:59.999Z&activityType=72 HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: ...

回复:

HTTP/1.1 200 OK
...