How to get city sights images from Google Places API - google-places-api

I use Google Places Photos Api and I want to get sights images for selected city by placeid or city title.
I try 2 methods:
1. f.e. I send request (used London placeid)
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJdd4hrwug2EcRmSrV3Vo6llI&key=API_KEY
get location from response
"lat": 51.5073509
"lng": -0.1277583
next step is request to
https://maps.googleapis.com/maps/api/place/radarsearch/json?location=51.5073509,-0.1277583&radius=5000&types=park|church|cafe|food|bar|night_club|stadium|store&keyword=&key=API_KEY
response contain many objects with placeid, that i use for new request like first
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ1eu1vwgIdkgRwjsifpZERQc&key=API_KEY
response contain photo_reference object which is the part of my image source
https://maps.googleapis.com/maps/api/place/photo?photoreference=CoQBcwAAAMLCk4X_WMliqIfISe-mgxRadycuzApodVcaCrTMGP6wQXJaquATedXMkvnjuLAfTG9xzBYQfSNm3iXV07wxHr_X_WDhfjz_yQjmqCYlKwYwK5hH-nl9qi-4ZZqKKtFuphFEY8ka25GYN2sTNMdd0v99j7YCzpR-lHJnl0zA9QoPEhBA5CnCgElBAU7Z92VTShg2GhQUes4fTRKiJlW6rYKYEaNilauWaA&key=API_KEY&maxwidth=1200
result image
It's not the best photo of London...
2.
Using textsearch with param query=sights+in+London
https://maps.googleapis.com/maps/api/place/textsearch/json?query=sights+in+London&key=API_KEY
This request return response which are contains photo_reference objects.
finally request is
https://maps.googleapis.com/maps/api/place/photo?photoreference=CnRnAAAAlLsg47UJRPVLdM8_sUbeLSia70EJ_mTisVDfCDTVUYNXl-35BGqzRARtq-Lt1CNcBWy3sKigfBVuF0iCr9-xqp1khK2l5JV3806LKvZrHJCaONYW35UBxxIIwxvxV-df4I4hg6f_zgeeIkWXGSYQhhIQNGYJl0fvHb3HslymbhH1thoUdLhGe8rJVCnyl_y0xAagzkFWs-Y&key=API_KEY&maxwidth=1200
result image
How can i get images like these

The Places API directly returns some photos for cities like London now. For example your query for London by Place ID:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJdd4hrwug2EcRmSrV3Vo6llI&key=API_KEY
Includes this photo of the Place of Westminster that is also shown on Google Maps.

It looks like you'd be looking for an API that surfaces Google Image Search results, and there is one: Google Custom Search
https://developers.google.com/custom-search/docs/overview
I'm not familiar with it, but there's already an answer for how to get just images out of your requests to this API:
Google custom search for images only

Related

Google Place API for airports

I have a requirement to show airports close to a particular lat/long with a specific radius. For that, I used google search nearby APIs below.
My problem is that I want to get only airport info but the problem is the API is fetching helipad too. How I can be more specific? Query URL :
https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=keyVal&location=lat,long&radius=10000&type=airport
Is there any way to filter the results to get airports only from the above ?
I believe that's how this endpoint works. But there is always a way to filter results as per your requirement. I can help more if you provide the how the response JSON looks like.

How to get all images for a given hotel, using Self-Service Amadeus API?

We tried in many ways without success.
Can only get one main picture.
(There was a question posted before on this topic Amadeus Hotel API Images, however the answer doesn't work.)
You can get more images using the second endpoint of the Hotel Search API and adding the parameter &view=FULL_ALL_IMAGES
For example:
https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=BGMILBGB&adults=2&roomQuantity=1&paymentPolicy=NONE&view=FULL_ALL_IMAGES

Google Place Autocomplete API not returning latest city name

I'm making use of google's Place Autocomplete API to get list of cities,
https://developers.google.com/places/web-service/autocomplete.
Problem is when I search "Bombay", it should return the new city name
"Mumbai". Same for "Calcutta" instead "Kolkata" and "Madras" to "Chennai".
Google Place Search api returns all the right renamed city names but unfortunately it's not for autocomplete use.
In Text search API you will get new names :
https://maps.googleapis.com/maps/api/place/autocomplete/json?key=YOUR_KEY&types=city&query=Bombay
So If you can use above API you can use.
In autocomplete add types=(cities) but it returning old names only, I think google data is not updated.
https://maps.googleapis.com/maps/api/place/autocomplete/json?key=YOUR_KEY&types=(cities)&input=Bombay
I think the fool proof solution for this is to use Google place autocomplete and get a list of predictions. Then use the first prediction's place_id as an input for Google Place details
Step 1
Step 2

Retrieve images from Instagram that contains more tag

I'm retrieving images from Instagram but I can't figure out why with this call:
https://api.instagram.com/v1/tags/trytag/media/recent?access_token=ACCESS_TOKEN
I can only retrieve images with one single trytag.
So if I post an image with more tags the link above can't retrieve it.
The current Instagram v1.0 API doesn't currently allow for multiple tag search. You could query for each tag separately and combine your results, or an alternative is to use a third party search like Mixagram, which is most likely doing the same thing but doesn't require an enormous amount of storage space upfront.

How to get yammer Likes count from embed

The documentation doesn't show how its possible to get the number of likes Yammer embed like you get with Facebook.
Is this possible in #yammer?
I'm using this embed script: https://developer.yammer.com/connect/#action-buttons
It's been a couple months so it could have changed, but the likes for the OG objects are not contained within the object but rather in the user's profile. So you can't see the number of likes on an OG object.
To get this functionality, I ended up using the like/unlike API and on success, I update a database with the like count for the specific OG object. Then on page load, I query the DB and get the like count.

Resources