# Google Maps Places API

You have to send a GET request to **`http://api.scrapingdog.com/google_maps/places`** with the below-given parameters.

Google Maps API pricing is available [here](https://www.scrapingdog.com/google-maps-api/#pricing).

### Parameters

| Parameter                                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>api\_key<br></p><p><mark style="color:red;">required</mark></p> | <p>Your personal API key. Available on your dashboard <br><br>Type: <em><strong>String</strong></em></p>                                                                                                                                                                                                                                                                                                                                            |
| <p>type<br><br><mark style="color:red;">required</mark></p>        | <p>The parameter must be set to "place" (i.e., <code>type=place</code>).</p><p>It is not required when using <code>place\_id</code>.<br><br>Type: <em><strong>String</strong></em></p>                                                                                                                                                                                                                                                              |
| <p>data\_id<br><br><mark style="color:red;">required</mark></p>    | <p>It is the Google Maps data ID. You can get this by entering the location name as the query in our <a href="https://docs.serpdog.io/google-maps-api">Google Maps API</a>. <br><br>Type: <code>String</code></p>                                                                                                                                                                                                                                   |
| place\_id                                                          | <p>The parameter uniquely identifies a place on Google Maps. Place IDs are available for most locations, including businesses, landmarks, parks, and intersections. <br>You can retrieve the <code>place\_id</code> using our <a href="/pages/bjYBmFJQ7bLRvOiHyTwf">Google Maps API</a>.</p><p></p><p>The <code>place\_id</code> can be used independently without any other optional parameters.<br><br>Type: <em><strong>String</strong></em></p> |
| country                                                            | <p>This is the <a href="https://en.wikipedia.org/wiki/ISO_3166-1">ISO code</a> of the country from which you are seeking the results.<br><br>Default Value - <strong><code>us</code></strong> <br><br>Type - <strong>String</strong></p>                                                                                                                                                                                                            |

{% tabs %}
{% tab title="cURL" %}

```json
cURL "https://api.scrapingdog.com/google_maps/places?api_key=APIKEY&place_id=ChIJT2h1HKZZwokR0kgzEtsa03k"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_key = "5eaa61a6e562fc52fe763tr516e4653"
url = "https://api.scrapingdog.com/google_maps/places"

params = {
    "api_key": api_key,
    "place_id": "ChIJT2h1HKZZwokR0kgzEtsa03k"
}

response = requests.get(url, params=params)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f"Request failed with status code: {response.status_code}")

```

{% endtab %}

{% tab title="Node JS" %}

```javascript
const axios = require('axios');

const api_key = '5eaa61a6e562fc52fe763tr516e4653';
const url = 'https://api.scrapingdog.com/google_maps/places';

const params = {
  api_key: api_key,
  place_id: "ChIJT2h1HKZZwokR0kgzEtsa03k"
};

axios
  .get(url, { params: params })
  .then(function (response) {
    if (response.status === 200) {
      const data = response.data;
      console.log(data)
    } else {
      console.log('Request failed with status code: ' + response.status);
    }
  })
  .catch(function (error) {
    console.error('Error making the request: ' + error.message);
  });

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

// Set the API key and request parameters
$api_key = '5eaa61a6e562fc52fe763tr516e4653';
$place_id = 'ChIJT2h1HKZZwokR0kgzEtsa03k';

// Set the API endpoint
$url = 'https://api.scrapingdog.com/google_maps/places/?api_key=' . $api_key . '&place_id=' . $place_id;

// Initialize cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the cURL request
$response = curl_exec($ch);

// Check if the request was successful
if ($response === false) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    // Process the response data as needed
    echo $response;
}

// Close the cURL session
curl_close($ch);

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

# Set the API key and request parameters
api_key = '5eaa61a6e562fc52fe763tr516e4653'
place_id = 'ChIJT2h1HKZZwokR0kgzEtsa03k'

# Construct the API endpoint URL
url = URI.parse("https://api.scrapingdog.com/google_maps/posts/?api_key=#{api_key}&place_id=#{place_id}")

# Create an HTTP GET request
request = Net::HTTP::Get.new(url)

# Create an HTTP client
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true # Enable SSL (https)

# Send the request and get the response
response = http.request(request)

# Check if the request was successful
if response.is_a?(Net::HTTPSuccess)
  puts response.body # Process the response data as needed
else
  puts "HTTP request failed with code: #{response.code}, message: #{response.message}"
end

```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        try {
            // Set the API key and request parameters
            String apiKey = "5eaa61a6e562fc52fe763tr516e4653";
            String place_id = "ChIJT2h1HKZZwokR0kgzEtsa03k";

            // Construct the API endpoint URL
            String apiUrl = "https://api.scrapingdog.com/google_maps/posts/?api_key=" + apiKey
                    + "&data_id=" + place_id

            // Create a URL object from the API URL string
            URL url = new URL(apiUrl);

            // Open a connection to the URL
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method to GET
            connection.setRequestMethod("GET");

            // Get the response code
            int responseCode = connection.getResponseCode();

            if (responseCode == 200) {
                // Read the response from the connection
                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder response = new StringBuilder();

                while ((inputLine = reader.readLine()) != null) {
                    response.append(inputLine);
                }
                reader.close();

                // Process the response data as needed
                System.out.println(response.toString());
            } else {
                System.out.println("HTTP request failed with response code: " + responseCode);
            }

            // Close the connection
            connection.disconnect();
        } catch (IOException e) {
            e.printStackTrace();
        }

```

{% endtab %}
{% endtabs %}

### Response

````json
{
    "place_results": {
        "title": "Stumptown Coffee Roasters",
        "data_id": "0x89c259a61c75684f:0x79d31adb123348d2",
        "place_id": "ChIJT2h1HKZZwokR0kgzEtsa03k",
        "rating": 4.5,
        "reviews": 1568,
        "gps_coordinates": {
            "latitude": 40.7457399,
            "longitude": -73.9882272
        },
        "provider_id": "/g/1hhw712x0",
        "thumbmail": "https://lh5.googleusercontent.com/p/AF1QipNtnPBJ2Oi_C2YNamHTXyqU9I8mRBarCIvM5g5v=w129-h86-k-no",
        "rating_summary": [
            {
                "stars": 1,
                "amount": 53
            },
            {
                "stars": 2,
                "amount": 31
            },
            {
                "stars": 3,
                "amount": 93
            },
            {
                "stars": 4,
                "amount": 349
            },
            {
                "stars": 5,
                "amount": 1042
            }
        ],
        "type": [
            "Coffee shop",
            "Cafe",
            "Coffee store",
            "Tea store"
        ],
        "type_ids": [
            "Coffee_shop",
            "Cafe",
            "Coffee_store",
            "Tea_store"
        ],
        "order_online": [
            "https://www.google.com/viewer/chooseprovider?mid=/g/1hhw712x0&g2lbs=AAEPWCtTHjHhiSjRb7f1KoaxIJQ6ekpyQS9-GiOSd_ZlYkhmHRaXZLtOU7CMvo14oeNsvIPxcqGLarj0fHgVHtS--QEn-qCsLA%3D%3D&hl=en-US&gl=us&fo_m=MfohQo559jFvMUOzJVpjPL1YMfZ3bInYwBDuMfaXTPp5KXh-&utm_source=tactile&gei=kEamZ4nPEbnckPIPhrzhiAw&ei=kEamZ4nPEbnckPIPhrzhiAw&fo_s=OA,SOE&opi=79508299&orderType=2&ebb=1&cs=0&foub=mcpp"
        ],
        "service_options": {
            "onsite_services": false,
            "takeout": false,
            "dine-in": false,
            "delivery": true
        },
        "extensions": [
            {
                "service_options": [
                    "Onsite services",
                    "Takeout",
                    "Dine-in"
                ]
            },
            {
                "highlights": [
                    "Fireplace",
                    "Great coffee",
                    "Great tea selection"
                ]
            },
            {
                "popular_for": [
                    "Breakfast",
                    "Solo dining"
                ]
            },
            {
                "accessibility": [
                    "Wheelchair accessible entrance",
                    "Wheelchair accessible restroom"
                ]
            },
            {
                "offerings": [
                    "Coffee",
                    "Quick bite"
                ]
            },
            {
                "dining_options": [
                    "Breakfast",
                    "Brunch",
                    "Lunch",
                    "Dessert"
                ]
            },
            {
                "amenities": [
                    "Restroom",
                    "Wi-Fi"
                ]
            },
            {
                "atmosphere": [
                    "Casual",
                    "Cozy",
                    "Trendy"
                ]
            },
            {
                "crowd": [
                    "College students",
                    "Family-friendly",
                    "LGBTQ+ friendly",
                    "Tourists",
                    "Transgender safespace"
                ]
            },
            {
                "payments": [
                    "Credit cards",
                    "Debit cards",
                    "NFC mobile payments"
                ]
            },
            {
                "pets": [
                    "Dogs allowed"
                ]
            }
        ],
        "unsupported_extensions": [
            {
                "service_options": [
                    "Delivery"
                ]
            },
            {
                "accessibility": [
                    "Wheelchair accessible parking lot"
                ]
            },
            {
                "planning": [
                    "Accepts reservations"
                ]
            }
        ],
        "adderss": "18 W 29th St,New York, NY 10001",
        "phone": "+13474147816"
    }
}
```
````


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scrapingdog.com/google-maps-scraping-api-documentation/google-maps-places-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
