【发布时间】:2020-07-31 13:06:51
【问题描述】:
我正在为我们当前的项目使用 Google Fit REST API。我们可以添加一些数据源,但有些我们不能添加。我们已经按照文档进行了操作。一些请求正在返回这种错误消息(我们甚至在他们的 OAuth 操场上尝试过)
"error": {
"status": "INVALID_ARGUMENT",
"message": "Data type does not match well-known data type with the same name",
"code": 400,
"errors": [
{
"reason": "invalidArgument",
"message": "Data type does not match well-known data type with the same name",
"domain": "global"
}
]
}
我们要添加的是我们已经允许的权限范围的数据源
https://www.googleapis.com/auth/fitness.activity.read
https://www.googleapis.com/auth/fitness.activity.write
{
"application": {
"name": "PersonalPulse",
"version": "1.0.0"
},
"dataType": {
"name": "com.google.activity.exercise",
"field": [
{
"name": "exercise",
"format": "integer"
},
{
"name": "repetitions",
"format": "integer"
},
{
"name": "resistance type",
"format": "integer"
},
{
"name": "resistance",
"format": "floatPoint"
},
{
"name": "duration",
"format": "integer"
}
]
},
"device": {
"manufacturer": "browser",
"model": "browser",
"type": "unknown",
"uid": "2",
"version": "10"
},
"type": "derived"
}
我们根据此处的文档按照说明进行操作 https://developers.google.com/fit/datatypes/activity#workout
我们将 PHP/Laravel 框架用于 Fitness api 和 cURL 用于 http 请求。如果有人知道我们为什么会收到错误,请提供帮助。谢谢。
您也可以在此处的 google playground 中尝试并粘贴范围 https://developers.google.com/oauthplayground/
【问题讨论】:
标签: php json laravel google-api google-fit