Google Places API Difference between _id and place_id - google-places-api

Could someone please explain me the key difference between the attributes: _id and place_id?
I know: Place IDs uniquely identify a place in the Google Places database and on Google Maps.
But what does the attribute _key representing ?
Example Response Code from the Google Api:
{
"_id": "d5bcd8db4a52088350ffb502c31c6694918d3907",
"place_id": "ChIJb3D1a2mnkUcRxop5hdAGiwY",
"lat": 27.991789,
"lng": 3.865653,
"name": "We Are here",
"rating": 0,
"user_ratings_total": 0,
"types": [
"school",
"point_of_interest",
"establishment"
],

I believe the _id field was deprecated and should disappear from responses shortly.
The Places fields reference, id, alt_id, and scope are deprecated as of September 3, 2019, and will be turned off on June 3, 2020.
The id and reference request parameters have been replaced by the place_id request parameter.
the alt_id and scope fields have no equivalent, as they were only used for the Place Add service which was turned off in July 2018.
source: https://developers.google.com/maps/deprecations#places_fields_reference_id_alt_id_scope_-
I guess Google just renamed deprecated id field as _id.

Related

In the Google Calendar API, how do I determine if a calendar is google-created calendar, or a user-created worskpace calendar

I need a way to distinguish a google-created calendar (ex. "Holidays in United States") from a user-created calendar (ex. "Engineering Department") in the Google Calendar API. There doesn't seem to be a distinct field for this, so I've been trying to find a pattern in the calendar's fields. From the CalendarList API:
{
...
"items": [
{
"kind": "calendar#calendarListEntry",
"etag": "\"1616104281883000\"",
"id": "en.usa#holiday#group.v.calendar.google.com",
"summary": "Holidays in United States",
"description": "Holidays and Observances in United States",
...
},
{
"kind": "calendar#calendarListEntry",
"etag": "\"1623344030696000\"",
"id": "c_g3s8ze0hkg2mc6kabr33f6r0ro#group.calendar.google.com",
"summary": "Engineering Department",
...
}
]
It seems like the only differentiating pattern is in the structure of the id field. The Google-created calendars have a readable email username, and the email domain is group.v.calendar.google.com. The user-created calendar on the other hand has a seemingly random string of characters as the username, and the email domain is group.calendar.google.com (notice the .v is missing).
This is a single example, but from the other examples I've seen the pattern is consistent. I haven't been able to find this pattern explicitly stated anywhere in the Google Calendar API docs, but maybe I'm missing something. Is this pattern explicitly stated anywhere? Or am I going about this wrong, and should be using a different feature of the API to distinguish these cases?

How to returns all public tweets regarding for specific location using tweeter api

Is there an API call which will returns all recent public tweets regarding for specific location?
I tried GET trends/place but it's WOEID not worked for Sri Lanka and Cities.
(Sri Lanka WOEID is 23424778)
I don't want to use tweeter GET search/tweets.json endpoint because search based on certain key words.
Is there any solution for this?
Finally, I got the answer. We could not get trends on each and every location using tweeter API 1.1.
you have to check our closest trending place using this API call. For Austalia
https://api.twitter.com/1.1/trends/closest.json?lat=37.781157&long=-122.400612831116
the response like be this.
[
{
"country": "Australia",
"countryCode": "AU",
"name": "Australia",
"parentid": 1,
"placeType": {
"code": 12,
"name": "Country"
},
"url": "http://where.yahooapis.com/v1/place/23424748",
"woeid": 23424748
}
]
after that, you can use GET trends/place.
even though you cannot use GET trends/place for geo-based filtering you can use tweeter search endpoint. if you do not want to filter it by keyword ignore the q parameter and use geocodeparameter. for example,
https://api.twitter.com/1.1/search/tweets.json?result_type=recent&geocode=5.954920,80.554956,12mi
In here mi is miles.

How do I create an all day event in the Google Classroom API Method: courses.courseWork.create?

I would like to add an all-day event to my Google Classroom Course as an assignment with the Classroom API found here: Method: courses.courseWork.create documentation
Here is the json request I've been using in their API explorer:
{
"title": "Lesson 1.1",
"workType": "assignment",
"state": "published",
"description": "This is a test assignment.",
"dueDate": {
"year": 2017,
"month": 9,
"day": 2
},
"dueTime": {
"hours": null,
"minutes": null
}
}
I've tried many variations, but it always posts the assignment due at 8:00 PM by default, never an allDay or all-day event. Removing the dueTime isn't allowed per the documentation. Yet, when I manually create a lesson it's an optional field. I inspected the post data and couldn't find out how this is happening.
It doesn't appear to mention how to create an all-day event in the Google Classroom API documentation and the Google Calendar API docs didn't give me any usable hints.
Any ideas?

How to differentiate between stock symbols with same name in Google stock API

I am using the following Google rest API to get stock data for a given symbol SYMBOL.
https://www.google.com/ig/api?stock=<SYMBOL NAME>
But there are certain symbols like "TCS" which has multiple company names in different parts of the world.eg: TECSYS Ltd in TSE and Tata Consultancy Services iN NSE.
How do I alter the query to get the TCS data in NSE stock Exchange.
Also is there any way to get the list of available symbols from Google?
This answer is in regard to #Ashwin 's bounty:
The URL provided by #Rockstart is part of Google's deprecated Finance / iGoogle API. It's been deprecated for several years.
However, as of July 2014, there is another method that still works - though it is also part of the deprecated finance API, so it probably won't stick around forever.
The method to get a specific stock is to add the stock exchange's name to the call:
http://www.google.com/finance/info?q=NYSE:TCS
As of the time I posted this answer, this response is returned:
// [ { "id": "348018767532275" ,"t" : "TCS" ,"e" : "NYSE" ,"l" : "20.67" ,
"l_fix" : "20.67" ,"l_cur" : "20.67" ,"s": "0" ,"ltt":"4:01PM EDT" ,
"lt" : "Jul 25, 4:01PM EDT" ,"lt_dts" : "2014-07-25T16:01:16Z" ,
"c" : "-0.33" ,"c_fix" : "-0.33" ,"cp" : "-1.57" ,"cp_fix" : "-1.57" ,
"ccol" : "chr" ,"pcls_fix" : "21" } ]
Regarding the second question, you may use
https://www.google.com/finance/match?matchtype=matchall&q=tcs
to get a list of symbols with "TCS" in their name, e.g.
{
"matches": [
{
"t": "TCS",
"n": "Tata Consultancy Services Limited",
"e": "NSE",
"id": "784961"
},
{
"t": "TCS",
"n": "Container Store Group Inc",
"e": "NYSE",
"id": "348018767532275"
},
'*snip*...'
]
}
And then you may use #Andy's call to get information about a symbol in a specific exchange.

Pull public event data from Google Calendar

I may be over thinking this a bit. On my web site, I would like to user certain data from my public google calendar. My plan is to pull it on the server side so I can do things like process it, cache it and format it the way I want.
I've been looking at using the Google Api libraries, but I can't get past any of the authorization hurdles. A service account sounds like what I really want, but I'm having trouble wrapping my head around how that works in this situation.
The old GDATA apis would be ok, but I'm not very keen on using them because they look fairly deprecated at this point by the newer libraries.
Since it is all public data, I'm hoping there is a simpler way to get to the event data that I'm looking for.
In case it matters, my site is Asp.Net (MVC).
Update
Ok, I was definitely way over thinking it. See my answer.
Now that RSS has been removed from Google Calendar, I've been in search of an easy replacement. I dug around and found the following in the Google Calendar API that seems to do the trick: calendar.events.list
Calendar Events List in Google API Explorer is a good place to get started with the different parameters and options - and it'll build you an example request string. You can see that I specified a minimum time of 2/5/2016, sort it by the start time, and show deleted events.
GET https://www.googleapis.com/calendar/v3/calendars/[CALENDAR ID HERE]/events?
orderBy=startTime&showDeleted=true&singleEvents=true&
timeMin=2016-02-05T00%3A00%3A00Z&key={YOUR_API_KEY}
Results are in JSON so you can parse it in your favorite programming language, ASP.NET or whatever. Result looks like:
{
"kind": "calendar#events",
"etag": "\"123456789123456\"",
"summary": "My Public Calendar",
"updated": "2016-01-29T14:38:29.392Z",
"timeZone": "America/New_York",
"accessRole": "reader",
"defaultReminders": [ ],
"items": [ {
"kind": "calendar#event",
"etag": "\"9876543210987654\"",
"id": "sfdljgsdkjgheakrht4sfdjfscd",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=sdgtukhysrih489759sdkjfhwseihty7934hyt94hdorujt3q95uy689u9yhfdgnbiwe5hy",
"created": "2015-07-06T16:21:59.000Z",
"updated": "2015-07-06T16:21:59.329Z",
"summary": "In-Service Day",
"location": "Maui, HI",
"creator": {
"email": "abra#cadabra.com",
"displayName": "Joe Abra"
},
"organizer": {
"email": "cadabra.com_sejhrgtuiwerghwi4hruh#group.calendar.google.com",
"displayName": "My Public Calendar",
"self": true
},
"start": {
"date": "2016-02-08"
},
"end": {
"date": "2016-02-09"
},
"transparency": "transparent",
"iCalUID": "isdt56y784g78ty86tgsfdgh#google.com",
"sequence": 0
},
{
...
}]
}
One good answer to this (the one I'm going with) is to simply use the calendar's public address to get the data. This is an option that I had forgotten about and it works fine for this particular situation.
You can find the url for the data if you go to the settings for a particular calendar and pick the format you want (I went with xml for this situation.)
The data that you get out of this service is very human-reader optimized, but I can make it work for what I'm doing.

Resources