Google Drive Realtime API "get" endpoint not working as expected - google-drive-api

We are trying to use the Google Drive API to retrieve the model of a Realtime document (API reference). However, if I call the "get" method to retrieve details of a Realtime File generated through the Google Drive Realtime API Playground app (with a blank "revision" field), the result is always:
{
"appId": "292824132082",
"revision": 1,
"data": null
}
even after a lot of editing on the model. If I try to specify a different revision (say, "2") the result is a 500 error:
{
"error": {
"code": 500,
"message": null
}
}
Are we doing something wrong or is there a problem with this specific API?

Calling "get" using the API Playground gets the realtime document associated with the API playground app, not the realtime document associated with your app.
If you update and get both with the API playground you should see contents.

Related

Google fit rest apis giving incorrect steps count

I'm developing a web application which requires to fetch user's steps count fromt Google Fit periodically.
I went through the API docs and found the REST End Point : https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate which gives the steps count.
I'm passing the data to this POST end point in below format.
{
"aggregateBy": [
{
"dataTypeName": "com.google.step_count.delta",
"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps"
}
],
"bucketByTime": {
"durationMillis": 86400000
},
"startTimeMillis": 1630568107871,
"endTimeMillis": 1630571402415
}
The steps count returned from the above request is different from the ones showing in my Google Fit app.
I tried searching this for days but didn't found anything.
How can I get the correct steps from this API as shown on the Google Fit app

403 Forbidden error with Google URL shortener API when accessing public data

I'm trying to expand a public short url using the Google URL Shortener API. The Google URL Shortener API is discontinued from March 30th as described in this blog post. Instead I should be using Firebase Dynamic Links but I can't find any docs on expanding URLs with FDL.
I'm only accessing public data so I have been using the shortener URL api with only an API key:
curl https://www.googleapis.com/urlshortener/v1/url\?shortUrl\=https://goo.gl/maps/JtZ2Yq19vJP2\&key\=MY_API_KEY
I always get the following response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}
When using the API explorer I'm getting the same response so I'm assuming it's because the API is being discontinued so how can I use Firebase Dynamic Links to do the same?
I am also had same issue since last week. I searched for solution but the reason is Google is shutting down its goo.gl URL shortening service.
https://www.engadget.com/2018/03/30/google-shutting-down-goo-gl-url-shortening-service/

exportlink for Google drive api v3

I'm switching to the Google drive V3 apis and I'm not able to retrieve the stream to the document.
Goal: I want to push a google drive document to another location and I need to retrieve the stream of the file in order to use it to push it to the target.
I can't find a way to do it using Google Drive API V3 !
In V2, I used:
downloadUrl = file.ExportLinks[(string)ExportTable[file.MimeType]];
And then I could use something like:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(downloadUrl));
I don't find the equivalent in V3.
I tried:
var getfile = _service.Files.Get(file.Id).Execute();
var request = _service.Files.Export(file.Id, getfile.MimeType);
System.IO.Stream stream = request.ExecuteAsStream();
And the content of the stream is:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "fileNotExportable",
"message": "Export only supports Google Docs."
} ],
"code": 403,
"message": "Export only supports Google Docs."
}
}
Of course, we don't want to download it to a local file and then generate a new stream from the file cached locally. We want to remain entirely in memory.
Thanks for your help
You can see that in the Migrate to Drive v3 docs, it says that:
The exportLinks field has been removed from files. To export Google
Documents, use the
files.export
method instead.
Check that page for other changes in v3 as well.
You can also create a link yourself if you are logged in as the right user or the file is public with a link:
https://docs.google.com/feeds/download/documents/export/Export?id={{ID}}&exportFormat=pdf

Using Place AutoComplete WebService API to get the Lat and Long

Implemented the Places Web Service API - Place Autocomplete https://developers.google.com/places/web-service/autocomplete and works fine, but it doesn't return the Latitude and Longitude of theses places predicted!
That is the request!
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Amoeba&types=geocode&location=37.76999,-122.44696&radius=500&regions=locality&key=KEY
This is an intended behavior. According to the documentation the autocomplete response doesn't contain any location information:
https://developers.google.com/places/web-service/autocomplete#place_autocomplete_results
You have the place ID in the response, so you can execute either place details or geocoding request to get the location for the given place.
For example, in your request the first prediction has a place ID ChIJjxz0JSktaE0RJio-PNWLd60, so you can execute the following request to get coordinates:
https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJjxz0JSktaE0RJio-PNWLd60&key=YOUR_API_KEY
The response will contain required information
"geometry":{
"bounds":{
"northeast":{
"lat":50.0903542,"lng":-86.29135079999999
},
"southwest":{
"lat":50.0850891,"lng":-86.3070178
}
},
"location":{
"lat":50.0890102,"lng":-86.2987103
},
....
I can also see that the feature request was filed in Google issue tracker, but Google rejected it and marked as Infeasible:
https://issuetracker.google.com/issues/35827993

How to get all notebooks/sections via GET notebooks/sections OneNote API

I tried GET notebooks API to get my all notebooks in Microsoft OneDrive.
When I owned 30 notebooks in OneDrive, the response JSON of GET notebooks API
had only 20 notebooks information. Is this a bug or a feature?
(The GET notebooks API reference says, 'The GET verb with the notebooks resource path
represents all notebooks to which a user has access in Microsoft OneDrive.')
In addition, the response JSON of GET notebooks API had "#odata.nextLink",
that value was "https://www.onenote.com/api/v1.0/notebooks?$skip=20".
I thought that I could get rest of notebooks by the above url.
However, I got '501 Not Implemented' as the response of the above url.
The error response JSON was as follows.
{
"error": {
"code": "20111",
"message": "OData Feature not implemented. Query option 'Skip.",
"#api.url": "http://go.microsoft.com/fwlink/?LinkID=400828"
}
}
Above issues applies to the GET sections API too.
What's the way to get all notebooks/sections via GET notebooks/sections API?
Oops - this was our bad. We just fixed it. It should work for you now and return ALL of your Notebooks and Sections