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?
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!
Use google takeout to export the Google Fitness historic data, then use the time interval for which you have the fitness data. You can only get the data for which you have synced the Google data. So frequently sync google Fit data.
Related
I’m in the middle of making an Express app. It’s just a learning project.
I’m getting some info from an Anime api called jikan.me, it provides info about different Anime series like a picture url and synopsis.
For example one is at https://api.jikan.me/anime/16 .
Now, the jikan api might have a json endpoint at anime/1 but there's nothing at anime/2.
I want to find a list of all the numbers (https://api.jikan.me/anime/[numbers]) that actually contain endpoints.
I've tried simply going to https://api.jikan.me/anime but it returns error: No ID/Path Given.
I'm expecting there is likely no absolute answer to this problem but that I might learn something about server-side code along the way.
Where would I begin to look to find this info?
This is a bit late but, Jikan is an unofficial REST API for MyAnimeList. The IDs are respective to the IDs on MAL. For example; https://myanimelist.net/anime/1 can be parsed through https://api.jikan.moe/anime/1 but the ID 2 does not exist on MAL. It's a 404, hence that error.
To initially get some IDs, you can try the search endpoint.
Furthermore, I'll be releasing REST 2.2 quite soon (this month) which will give you the ability to parse from pages like these and thus you'll get another endpoint that provides a handful of IDs to get their data from.
Source: I'm the developer of Jikan
If it's not in the documentation it's probably information not available to you... a REST api needs to be specifically configured to offer certain endpoints, that number at the end might just be an ID that's searched for in an internal database and there's no way for the application to know if there's gonna be something there; all they can do is return an error message for you to handle as is the case here.
I have an API that produces JSON like this:
)]}',
{
//JSON DATA
}
The //JSON DATA is valid JSON, but the )]}', up top is not.
When I try to GET this data via a Logic App, I get:
BadRequest. Http request failed: the content was not a valid JSON.
So, a few related questions:
1) Can I tell the logic app to return the invalid JSON anyway?
2) How can debug the issue better? I happen to know that the response is invalid, but what if I didn't? Can I see the raw data somewhere?
3) This is all done via the Azure web portal. Are there better tools? Visual Studio?
I should also mention that if I call a route on the same API that returns XML instead of JSON, then the Logic App works fine. So it definitely doesn't like the JSON response in particular.
Thanks!
First of all, please do not post three questions as a single question.
Question 1). The best thing you can do is make the API return a valid JSON object. This is good for million reasons. Here're a few:
it's pretty much a standard (either valid JSON or XML -- yeah, old school way);
therefore, no users of this API (including you) will need to struggle and guess what's going on and why;
your Logic App's step will just work without adding extra complexity;
you will make this world and your karma better.
If API-side changes are not within your reach, I don't think you can do much. If you're lucky and the HTTP action is successful (Status Code 2xx), you can try to use a Query Action with a function that truncates the first characters. It will look something like this (I don't know the exact syntax): #Substring(body('myHttpGet'), 4, length(body('myHttpGet')) - 4) where myHttpGet is the id of the Http Get action.
However, once again, if possible, I strongly recommend fixing up the API which is the root cause of the problem, instead of dealing with garbage response after that.
UPDATE Another thing you can do is wrap the dirty API. For example, you could create a trivial Azure Function that invokes the API you don't directly control, and sanitizes the response for you consumption requirements. This Azure Function function should be easy to call from the Logic App. It costs almost nothing (unless we're talking millions of requests/month). The only drawback here is the increasing latency, which may be not an issue at all -- test it and see whether it adds less than 100ms or so... Oh, and don't forget to file a ticket with the API owner, they make our world a bad place!
Question 2) In Azure Logic App web UI you can Look into the execution details and the error will definitely be there.
Question 3) You're asking for a tool recommendation which is by definition a highly subjective thing and is off-topic on StackOverflow.
TL/DR: The other app is not producing valid JSON.
Meaning, this is not a problem for you to solve. The other app has to return valid JSON if the owner claims it should.
If they cannot or will not produce valid JSON, then the first thing you need to do is inform your management that you will have to spend a lot of extra time accommodating their non-standard format.
I need to make a request to Google and get all results for the last hour or day and etc. You can find the additional instrument panel after any request of searching in the end. How I can do it?
You will want to use the daterange: search operator. Example:
java daterange:2455332-2455334
The drawback is that you have to use julian formatted time. Here is a helpful converter: http://www.onlineconversion.com/julian_date.htm
I am writing a program to pull some JSON data off of a 3rd party website. What I would like to happen is run my method to pull the data, and cycle through the data finding seeing if there is a newer date then the last time the system pulled it. If there is, I want to send out a local notification that something was "Found". I expect if there is new data to be there every 5 min, but I would like the users to schedule a time interval from 5 min to once a day. There is more I would like to check on but this is where I want to start.
I don't know where to begin, any help will be appreciated.
I am building this project in SWIFT on Xcode 6.4
You should look into the following
For url fetching (For you json) - NSURLSession tutorial
Look at ETAG, Last-Modified headers to check if JSON file is modified at server. Refer this
NSTimer for for your timing requirements. Refer this
For notifications: Use NSNotification. Refer this
I am working with an Arduino project that uses Google AppEngine to post data that it collects from various sensors. To give you an idea, here is a link to the project: http://www.iowa-aquaponics.com
I am finding that occasionally the Arduino will post, or goggle app engine receives, data that isn't valid.
This would be a good entry:
http://www.mysite.appspot.com/adacs/arduino?&Temp=80.6&Humidity=82.2&AmbientLDR=16&WaterTemp=79.3&pHValue=5.03&doValue=2.5
Occasionally, a character will drop and i will either get a decimal point that is missing or it will drop an & and what should be a number value like 80.6 turns into a sting like 80.6umidity.
Since the Google AppEngine is seeing this as a string, it goes in the datastore no problem. When I query this data into a JSON table, it will fail because it is looking for a number and it is getting a string.
I was thinking of writing a CRON job that would run each time a new data set was submitted and it would validate the data and delete the record if any of the elements were not valid. I am collecting data every 10 minutes or so, so I am fine with occasionally dropping some records. I would rather have this over not being able to see any data because one element of the JSON table is not valid.
I am curious of some other ideas to handle this situation. If there is a best practice for this, please let me know. Thanks everyone.