Я бы хотел получить техническую помощь по Google Rest Rest API.
Я создаю приложение, для которого требуется доступ к информации о местоположении, и в ответ на мой запрос я получаю этот json.
{
"access_token": "ya29.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"scope": "https://www.googleapis.com/auth/fitness.activity.read https://www.googleapis.com/auth/fitness.location.write https://www.googleapis.com/auth/fitness.location.read https://www.googleapis.com/auth/fitness.body.read",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "1/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Таким образом, используя access_token, я сделал следующий запрос, и он работает
https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate
Тело запроса:
{
"startTimeMillis":1543682285000,
"endTimeMillis":1543941485000,
"aggregateBy: [
{
"dataSourceId":"derived:com.google.calories.expended:com.google.android.gms:merge_calories_expended",
"dataTypeName":"com.google.calories.expended"
}
],"bucketByTime":{"durationMillis":259200000}
}
И я получаю правильный ответ
, но когда сделано со следующим телом (dataSourceId и dataTypeName изменены)
{
"startTimeMillis":1543682283000,
"endTimeMillis":1543941483000,
"aggregateBy":[
{
"dataSourceId":"derived:com.google.location.sample:com.google.android.gms:merge_location_samples",
"dataTypeName":"com.google.location.sample"}
],"bucketByTime":{"durationMillis":259200000}
}
Я получил
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "No permission to read data for this private data source."
}
],
"code": 403,
"message": "No permission to read data for this private data source."
}
}
Также попытался использовать все пригодные области (Чтение и запись):
"scope": "https://www.googleapis.com/auth/fitness.activity.write
https://www.googleapis.com/auth/fitness.blood_pressure.read
https://www.googleapis.com/auth/fitness.blood_pressure.write
https://www.googleapis.com/auth/fitness.reproductive_health.write
https://www.googleapis.com/auth/fitness.activity.read
https://www.googleapis.com/auth/fitness.reproductive_health.read
https://www.googleapis.com/auth/fitness.nutrition.write
https://www.googleapis.com/auth/fitness.body_temperature.write
https://www.googleapis.com/auth/fitness.body_temperature.read
https://www.googleapis.com/auth/fitness.nutrition.read
https://www.googleapis.com/auth/fitness.oxygen_saturation.write
https://www.googleapis.com/auth/fitness.body.write
https://www.googleapis.com/auth/fitness.body.read
https://www.googleapis.com/auth/fitness.oxygen_saturation.read
https://www.googleapis.com/auth/fitness.blood_glucose.write
https://www.googleapis.com/auth/fitness.location.write
https://www.googleapis.com/auth/fitness.location.read
https://www.googleapis.com/auth/fitness.blood_glucose.read"