How to retrieve recently updated contacts? - google-apps-script

What is an efficient way to find recently updated Google contacts?
The obvious solution to retrieve all contacts with ContactsApp.getContacts() and iterate through all of them with getLastUpdated() doesn't seem particularly efficient and I am worried that such a code will exceed the time allowed if there are several thousand contacts.
Thanks.

You cant with ContactsApp. You can use urlFetch and use the raw contacts v3 api. Use a query using updated-min, remember what your last updated-min was so you only get ghe ones updated since your last call. See the api and this: https://developers.google.com/google-apps/contacts/v3/reference#Parameters

Related

Is there an alternative People API functionality for Contacts API that searches contacts and returns approximately 100 contacts?

People API has a method (searchContacts) which caters to searching contacts. However, it's only capped at 10 results/contacts returned. I would like to know if there is another alternative method or functionality that would search and return more or less 100 results.
Unfortunately, what you want cannot be achieved.
However, what you can do in this situation is to file a feature request on Google's Issue Tracker here and provide all the needed details.

How to get sorted list of a folder using google drive API?

I tried to use this method. It returns random list of items in a folder. And I need to get list sorted by title or by last modified date.
Now, I send get request like this:
https://content.googleapis.com/drive/v2/files/0AHHQVSKDfdFSDUk9PVA/children?maxResults=1000
NB The answer below applies to the v2 API and is out of date. There is now a sort feature orderby.
Looking at your URL, I have two comments:-
Giving maxResults=1000 isn't a great idea. Firstly, it leads to timeouts of the API which would be avoided with a smaller value. Secondly, it suggests that you are trying to avoid coding for multiple pages of output, which is a risk since Drive doesn't guarantee that it will always return the maxResults count. It might return less, with a nextPageToken.
If you really want to retrieve 1000 entries, it's probably a good idea to specify a projection to reduce the size of the http response.

Locating current Google Place i'm at by latitude/longitude via Google Places API

i have a lat/long location data and i need to get current Google Place where i'm at now.
For example, if i'm in a shop(cafe, gym, etc..), i need to get info about THAT particular shop(cafe, gym, etc..).Or at least the closest one.
So, i'm doing it this way:
First i fetch place basic info(placeid,name, etc.) via Google Places API Nearby Search request:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.7597351,-73.9836576&radius=16.66&key=...
Then i find the closest one(which is apparently where i am) and perform Place Details request with it's placeid
So, everything works fine, except for some places like the one located at 40.7597351,-73.983657 (New York Guitar lab shop) which i can see on google map, but can't get in my response. Even places that are further from my location than this, are being found fine.
I've already tried to use rankBy=distance and then checking if the result is in required radius manually, still no use. Actually, maybe this approach is right, but as told in the docs, it's required to use types parameter with rankBy=distance. So, i set types=establishment since i actually need everything except addresses and locality tokens returned. I think that the problem is some places i need, are neither counted as establishments nor as localities, but i don't know the optimal way to exclude
all types specified at (https://developers.google.com/places/documentation/supported_types) Table 2 from my response. Is there a way to get only places which types are in Table 1 (except for specifying them ALL in my types param, haha)
So, could you please help me with how can i do this?
Thanks:)
P.S. here is very similar but unaswered question
Google Places API Displaying Inaccurate Result
It seems that there's explanation here (https://developers.google.com/places/faq#why_are_some_places_never_returned_even_though_they_have_google_pages). Looks like some places are just not yet verified by Google.
And yes, the establishment is the generic category for all non-localities. So you can be sure that if you set type=establishment then you'll have as much places as you will, if you'll specify all types from Table 2. Good Luck!

Maximum limit on number of people can access a public Google spreadsheet?

I am developing an application which fetchs data from Google Spreadsheet using query.
The data comes in JSON format. I want to know whether there is any restrictions on number of request that can be sent to Google server for fetching the JSON from the spreadsheets.
I mean is there any restrictions like per hour or per day N requests.
Never seen a limit and suspect there is no such limit, but might be wrong.
Any ideas of rough volumes? I have has about 10 people at once use the service, it did slowdown a little, but was ok.
If it helps, the gdata style spreadsheet API takes about 1 Second/read and 2-10seconds/write (large sheets are slower)

Google Places update via API

Do you know if it is possible to update an existing place via API in Google Places?
Suppose I need to change the "Hours of operation" because my business activity has flexible open hours and I want to automate this task via script.
Thank you.
Well, Google Palces API decoumentation tells only about deleting or adding new places:
https://developers.google.com/places/documentation/
So it seems impossible for now, but it is still beta, so maybe it will be possible in future.