Php Google fit REST API无法添加部分数据源
我正在尝试添加一个特定的数据源,其作用域是Php Google fit REST API无法添加部分数据源,php,laravel,google-api,google-api-php-client,google-api-client,Php,Laravel,Google Api,Google Api Php Client,Google Api Client,我正在尝试添加一个特定的数据源,其作用域是 https://www.googleapis.com/auth/fitness.activity.read https://www.googleapis.com/auth/fitness.activity.write 但是当我尝试这样做的时候。它给我返回了一个错误 { "reason": "invalidArgument", "message":
https://www.googleapis.com/auth/fitness.activity.read
https://www.googleapis.com/auth/fitness.activity.write
但是当我尝试这样做的时候。它给我返回了一个错误
{
"reason": "invalidArgument",
"message": "Data type does not match well-known data type with the same name",
"domain": "global"
}
我将POST请求发送到此URL
https://www.googleapis.com/fitness/v1/users/me/dataSources
这是我的请求主体
{
"dataStreamName": "MyDataSource",
"type": "derived",
"application": {
"detailsUrl": "http://example.com",
"name": "Foo Example App",
"version": "1"
},
"dataType": {
"field": [
{
"name": "activty_type",
"format": "integer"
}
],
"name": "com.google.activity.segment"
},
"device": {
"manufacturer": "Example Manufacturer",
"model": "ExampleTablet",
"type": "tablet",
"uid": "1000001",
"version": "1.0"
}
}
我使用PHP/Laravel作为一种语言,使用CURL作为http请求库。有人能告诉我我做错了什么吗?某些作用域已成功添加,但有些作用域无法添加
Google docs reference:根据文档,activity_type(您键入的)不是正确的字符串
com.google.activity.segment
需要activity
字段
看
因此,当它在Google Fit API测试控制台中返回预期的资源和HTTP 200时,这将起作用:
{
"dataStreamName": "MyDataSource",
"type": "derived",
"application": {
"detailsUrl": "http://example.com",
"name": "Foo Example App",
"version": "1"
},
"dataType": {
"field": [
{
"name": "activity",
"format": "integer"
}
],
"name": "com.google.activity.segment"
},
"device": {
"manufacturer": "Example Manufacturer",
"model": "ExampleTablet",
"type": "tablet",
"uid": "1000001",
"version": "1.0"
}
}