Next Previous

Places API Text Search

83

Text search is part of Googe Places API as well

Text Search request returns a set of places based on the text query string.

For Example Restaurants in Toronto

✅ Text Search HTTP Request Base URL

https://maps.googleapis.com/maps/api/place/textsearch/

Required URL Parameter

namedescription
JSON or XMLoutput format (json recommended)

Required Query Parameters

namedescription
keyYour API Key from Google Cloud Platform
querythe value must be specified in the format of latitude, longitude

Here is a sample URL with required parameters

https://maps.googleapis.com/maps/api/place/textsearch/json?key=[YOURAPIKEY]&query=restaurants-in-toronto

make sure to use your own API Key

The returned JSON object will look like this.

{
	"html_attributions": [],
	"next_page_token": "CpQCBQEAAApbUDkIJiXvounmS4nANri-KSA2pss4MWpRu_T_6Wr",
	"results": [{
			"formatted_address": "1 Richmond St W, Toronto, ON M5H 3W4, Canada",
			"geometry": {
				"location": {
					"lat": 43.6514635,
					"lng": -79.37947009999999
				},
				"viewport": {
					"northeast": {
						"lat": 43.65286377989273,
						"lng": -79.37816852010725
					},
					"southwest": {
						"lat": 43.65016412010728,
						"lng": -79.3808681798927
					}
				}
			},
			"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
			"id": "91268afb982f014d3e35900861197e41e5aae98e",
			"name": "Richmond Station",
			"opening_hours": {
				"open_now": false
			},
			"photos": [{
				"height": 3008,
				"html_attributions": [
					"<a href=\"https://maps.google.com/maps/contrib/112364593838215418223\">A Google User</a>"
				],
				"photo_reference": "CmRaAAAA7Upk1hrC6e_i9JEN3vx1J",
				"width": 4542
			}],
			"place_id": "ChIJJZP2IzPL1IkRoIXM5dEE9ck",
			"plus_code": {
				"compound_code": "MJ2C+H6 Toronto, Ontario",
				"global_code": "87M2MJ2C+H6"
			},
			"price_level": 3,
			"rating": 4.7,
			"reference": "ChIJJZP2IzPL1IkRoIXM5dEE9ck",
			"types": [
				"restaurant",
				"food",
				"point_of_interest",
				"establishment"
			],
			"user_ratings_total": 1890
		}
	],
	"status": "OK"
}

Next Previous