问题
I know this has been asked similarly in two other threads, but even with both of those I still have not been able to get a simple step-count.
I've been going through the documentation and have been sending requests through OAuth 2.0 Playground but I can't for the life of me get any meaningful numbers in a response, or I fear I'm overlooking something or looking in the wrong place.
What I've tried: 1) Got all data sources at this request URL: https://www.googleapis.com/fitness/v1/users/{userId}/dataSources
2) Gone through two specific SO threads: One, Two
From suggestions there, I sent this request:
https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.step_count.delta:com.google.android.gms:estimated_steps/datasets/{maxtime}-{mintime}
with values for maxtime/mintime that corresponded from April last year to today and the response I got was this:
{
"minStartTimeNs": {mintime},
"maxEndTimeNs": {maxtime},
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps"
}
where mintime and maxtime were the values in the request. I'm continuing to read through the docs in the hope that I'm missing something, but no luck currently. Any thoughts?
回答1:
I have been stuck with this request too. You get this response because there is no data within this range of time. Make sure that mintime and maxtime are in nanoseconds and try again. For example, today is: 1442404933000000000 Good luck!
来源:https://stackoverflow.com/questions/32215517/extracting-aggregate-data-and-other-data-from-the-google-fit-rest-api