Given a google doc retrieved through the Google docs API and its comments retrived with the Drive API,
How do you know where in the document a comment corresponds?
I've been inspecting all the fields and couldn't find a relation except the quotedFileContent that contains the commented text in the doc, but this would resolve ambiguously if that text is duplicated.
You cannot retrieve the location of a comment using Drive API.
As you can see in the official documentation, the Comment resource has an anchor field that provides information on the region of the document. Nevertheless, if you use the API to get information about a comment, you will see that the anchor field in the response is actually a string identifier composed of a kix prefix and a certain anchor ID as a suffix, which don't really give you an idea of where the comment is located.
The problem is not just about retrieving the locations to which a comment is anchored, but also about creating anchored comments in a desired location using the API, as you can see here.
Basically, as it is currently implemented, this anchor tool is meant for third-party integrations to use this API to specify their own custom anchor data.
There are several open cases in Issue Tracker related to this:
https://issuetracker.google.com/issues/36756056
https://issuetracker.google.com/issues/36763384
Reference:
https://developers.google.com/drive/api/v3/manage-comments
https://www.youtube.com/watch?v=ZBU52nacbLw
Related
We are currently trying the Google places autocomplete api, but it seems as though Google places autocomplete api also returns invalid (non existent) addresses in the search result.
We want to receive only valid / actual addresses when the user types in the address autocomplete, is there a way to do it?
I searched the api docs but couldn't find anything much helpful.
There is a google places validation api but it only validates after given a single address, but we want to show only valid/actual addresses on search autocomplete and also don't want to call validation api for each of the search result items.
Went through official doc and also experimented several stackoverflow answers but those didn't match our requirements.
SO ref-1
This is Working as Intended as of now
I tried reproducing the Autocomplete request using this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=332%20Kennedy%20drive,%20Torrington,%20CT&types=address&key=API_KEY
And the results returned has a long Place ID.
According to the Places API documentation:
"Place IDs uniquely identify a place in the Google Places database and on Google Maps."
The documentation also says that the API may return a different place ID in the response. These place ID types include:
Street addresses that do not exist in Google Maps as precise addresses, but are inferred from a range of addresses.
Segments of a long route, where the request also specifies a city or locality.
Intersections.
Places with an address component of type subpremise.
These IDs often take the form of a long string.
This explains why the API still returned a street address for the input =332 Kennedy drive, Torrington, CT using types=address. The use case of autocomplete is to help the users obtain the closest result even if they are requesting an ambiguous query. So the Autocomplete always tries to return the closest result to their input and types. In your case, it returned a street addresses that do not exist in Google Maps as precise addresses, but are inferred from a range of addresses.
There's a public bug on the issue tracker that is somehow related to this. On the comment #5, it says that:
Suggestions are sometimes created for addresses that may not exist, if there are chances that they do.
Retrieving details for such suggestions may result in the suggested address, if it actually exists or can be synthesized from existing data. Otherwise, the result may be a different address, one that actually exists.
Possible workaround
One thing you can do is to use the validation API.
But since you mentioned that you don't want to use it, I tried the Autocomplete request using this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=332%20Kennedy%20drive,%20Torrington,%20CT&types=establishment&key=API_KEY
I just changed the types=address to types=establishment and it seems to return legit addresses. I'm not sure if this would fit on your use case, so you can just comment down if it does not.
And if it does not, I found a similar public bug on the issue tracker which says that similar issues like these are currently being worked on by the Google engineers internally. So what I would advise you to do wait for on update from this public bug.
There's no definite timeline on how long this will be fixed, but you can star it to be notified whenever there's an update.
Hope this helps!
== UPDATE ==
I tried playing around with the types and got to a point where I tried putting an array of types from this table. I tried this:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=332%20Kennedy%20drive,%20Torrington,%20CT&types=street_address|street_number|premise&key=API_KEY
and it did return some real addresses. I changed the types=address to types=street_address|street_number|premise. You could try it out yourself and play around with the types and see if it works for your use case.
for more information about types, here's a link to the documentation.
I have the Place Id of a place on google maps in my app. Is there a way to put the place Id in a URL and have it directly link to the page? Or does it have to be done through the URL?
I can't seem to find anything detailing this in the docs. I've tried below, but it just gets me the standard google maps page:
https://maps.google.com/maps?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4
Recently, in May 2017, Google launched the new Google Maps URLs API. You can read about this API in the official documentation
https://developers.google.com/maps/documentation/urls/guide
So, from now on you can construct a URL for Google Maps using the place ID. In your particular case this URL will be
https://www.google.com/maps/search/?api=1&query=Google&query_place_id=ChIJN1t_tDeuEmsRUsoyG83frY4
Hope this helps!
Not directly, using the placeID you can get a variety of information in JSON or XML format, among them there are also the lat lng of the place and its address with which you can easily locate the map
google developer doc
The URL for a specific Google Place is returned by the places details API endpoint.
If for example you query:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJV2BQ4laeekgRFauLvdXbFXE&key=YOUR_API_KEY
You will see that in the returned JSON there is a key 'url' which points to https://maps.google.com/?cid=8148660811851344661
The correct format, at this time, to produce a general link that goes directly to correct google place is: https://maps.google.com/?cid=[place_id]&t=[maptype]
The map type parameter "t" is apparently necessary. Without it, google maps seems to perform a more general search when the link opens that is sometimes successful and sometimes not. With it, maps opens to correct place each time whether it opens in browser or in app on mobile.
Set this parameter to "m" for a street map and "k" for a satellite map.
A lot of answers on SO show the following syntax which often pulls unwanted results if two locations of the same name are nearby e.g.:
https://www.google.com/maps/place/Starbucks/#43.088554,-88.06579,17z/
If you are already using google places api, then you have the place_id, so i recommend using it to avoid ambiguity.
Google just introduced a new feature in Google Drive SDK which is the ability to set properties to files, as key/value pairs.
According to the blog post on Google Developers blog we can use these properties as searchable fields. However I cannot see in the documentation how to search for files using these properties.
For example: retrieve all files where property A has the value X.
I know the feature is brand new but I could really make use of this in my current project. Have I missed anything ?
Well I find, its possible to search on drive based on properties param.
Check doc. https://developers.google.com/drive/web/search-parameters
Code Snippet :
resp = newDriveService.files().list(q="properties has { key='customKeyA' and value='customKeyAValue2' and visibility='PUBLIC' }").execute()
Note : you have to specify all 3 params viz. key, value and visibility while searching. If you don't use it will throw Invalid Params exception.
Unfortunately, we don't currently support this. This is currently a high priority for Google and they are working on it. Stay tuned.
I can get place details from Google places API when I know the reference by using:
https://maps.googleapis.com/maps/api/place/details/json?reference=CmRYAAAAciqGsTRX1mXRvuXSH2ErwW-jCINE1aLiwP64MCWDN5vkXvXoQGPKldMfmdGyqWSpm7BEYCgDm-iv7Kc2PF7QA7brMAwBbAcqMr5i1f4PwTpaovIZjysCEZTry8Ez30wpEhCNCXpynextCld2EBsDkRKsGhSLayuRyFsex6JA6NPh9dyupoTH3g&sensor=true&key=API_KEY_HERE
However, I want to get the same information by using the ID instead. So the same place in the query above would be something like:
https://maps.googleapis.com/maps/api/place/details/json?id=4f89212bf76dde31f092cfc14d7506555d85b5c7&sensor=true&key=API_KEY_HERE
Is such a thing possible?
This will be part of a search filter I'm building, part of which is location. My search parameters are passed to the url, so I plan to do the same with the selected location from the places autocomplete. Using id is much shorter than reference, so more suitable for the querystring. Unless there is a better way to do it?
You can search Place data by PlaceID
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJF7QkuDsDLz4R0rJ4SsxFl9w&key=YOUR_KEY
It is now possible to fetch place data by placeId:
https://developers.google.com/maps/documentation/javascript/examples/place-details
It is not possible to get a place details with id, you do need to use the reference.
as specifically mentioned in the bottom of this link - http://goo.gl/KFDbl
Apparently both the id and reference are deprecated anyway.
From the Google Places Autocomplete Docs (Aug 2014):
"Note: The id and reference fields are deprecated as of June 24, 2014. They are replaced by the new place ID, a unique identifier that can be used to compare places and to retrieve information about a place. The Places API currently returns a place_id in all responses, and accepts a placeid in the Place Details and Place Delete requests. Soon after June 24, 2015, the API will stop returning the id and reference fields in responses. Some time later, the API will no longer accept the reference in requests. We recommend that you update your code to use the new place ID instead of id and reference as soon as possible. "
https://developers.google.com/places/documentation/autocomplete
Google Contacts API 3.0 is described here:
https://developers.google.com/google-apps/contacts/v3/reference But this document is not complete.
In googles contacts form I can enter a name that is used to file the record rather than the contacts full name. I can access the record via XML or JSON and I get this field as gContact:fileAs. But the reference-Document does not contain a description of gContact:fileAs.
What else is missing in this reference-document?
On the other hand the description contains fields like gContact:billingInformation or gContact:jot or gContact:mileage that seem not to have a place in the contact form. So to me there seems to be no way to enter values into one of those fields, so they never will contain anything, and so they never will appear in the xml- or json-file that I can get from google. So I think there is no need to implement those fields in my application. - Or am I wrong with this?
So, please:
Where is a thorough, accurate and complete description of Google Contacts API 3.0?
Currently the best resource is: https://developers.google.com/google-apps/contacts/v3/ & https://developers.google.com/google-apps/contacts/v3/reference, this is the most accurate and up-to-date resource available at this time.
I realise this is not the answer you want, but it is the correct answer nonetheless.