# Google Shopping API

Here is the list of default parameters you can use with this API :

|                            Parameters                           |                                                                                                                                                                                                                                                                                                       Description                                                                                                                                                                                                                                                                                                      |
| :-------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| <p>api\_key<br><br><mark style="color:red;">required</mark></p> |                                                                                                                                                                                                                                                                                                  This is your API key.                                                                                                                                                                                                                                                                                                 |
|     <p>q<br><br><mark style="color:red;">required</mark></p>    |                                                                                                                                                                                                                                                                               <p>Type: <code>String</code><br><br>Google Search Query</p>                                                                                                                                                                                                                                                                              |
|                               num                               |                                                                                                                                                                                                                                                                       <p>Type: <code>Number(Integer)</code><br><br>Number of results per page</p>                                                                                                                                                                                                                                                                      |
|                                gl                               |                                                                                                                                                                                              <p>Type: <code>String</code></p><p></p><p>Default: <code>"us"</code><br>  Name of the country. The name should be in <a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes">ISO 3166 Alpha-2</a> format.</p>                                                                                                                                                                                              |
|                                hl                               |                                                                                                                                                                                                                                                <p>Type: <code>String</code></p><p><br>Default Value: <code>"en\_us"</code><br>The language of the requested results.</p>                                                                                                                                                                                                                                               |
|                               page                              |                                                                                                                                                                                                    <p>Type: <code>Number(Integer)</code><br><code>\[0,10,20....]</code><br><br>Default: <code>0</code><br>(Enter 10 for 2nd-page results, 20 for 3rd, etc .)<br>The page number to get targeted search results.</p>                                                                                                                                                                                                    |
|                                lr                               |                                                                                                                                                                                                 <p>Type: <code>String</code><br><br>Limit the search to one or multiple languages.<br>It is used as <mark style="color:red;"><code>lang\_{language code}</code></mark><em>.</em> For example <em>- "</em>lang\_us".</p>                                                                                                                                                                                                |
|                               uule                              |                                                                                                                                                                                                                         <p>Type: <code>String</code><br><br>Used to encode a place an exact location(with latitude and longitude) into a value used in a cookie, an URL, or an HTTP header.</p>                                                                                                                                                                                                                        |
|                             duration                            | <p>Type: <code>String</code><br><br>Use this as <code>"d/w/m/mn/y"</code><br>where n is from <code>0-10</code>.</p><p><mark style="color:red;"><code>d</code></mark> - the previous 24 hours,  <mark style="color:red;"><code>w</code></mark> - the previous seven days, <mark style="color:red;"><code>m</code></mark> - the previous month, <mark style="color:red;"><code>mn</code></mark> - the previous n number of months, <mark style="color:red;"><code>y</code></mark> - past year</p><p><br>The <code>duration</code> parameter requests search results from a specified time period (quick date range).</p> |
|                               nfpr                              |                                                                                                                                                      <p>Type: <code>Boolean</code></p><p><br>Default: <code>0</code><br>It excludes the result from an auto-corrected query that is spelled wrong. It can be set to <mark style="color:red;"><code>1</code></mark> to exclude these results or <mark style="color:red;"><code>0</code></mark> to include them.</p>                                                                                                                                                     |
|                               tbs                               |                                                                                                                                                                                                                                                        <p>Type: <code>String</code><br><br>to be searched - An advanced parameter to filter search results. </p>                                                                                                                                                                                                                                                       |
|                               safe                              |                                                                                                                                                                       <p>Type: String<br><code>\[active/off]</code><br></p><p>Default: <code>off</code><br>To filter the adult content set <code>safe</code> to <mark style="color:red;"><code>active</code></mark> or to disable it set it <mark style="color:red;"><code>off</code></mark>.</p>                                                                                                                                                                      |
|                               html                              |                                                                                                                                                                                                                                                         <p>Type: <code>Boolean</code><br><br>Default: <code>false</code><br>To render response as raw HTML.</p>                                                                                                                                                                                                                                                        |

### API Example:

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

```json
cURL "https://api.serpdog.io/shopping?api_key=APIKEY&q=shoes&gl=us"
```

{% endtab %}

{% tab title="Node JS" %}

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

axios.get('https://api.serpdog.io/shopping?api_key=APIKEY&q=shoes&gl=us')
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.log(error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
payload = {'api_key': 'APIKEY', 'q':'shoes' , 'gl':'us'}
resp = requests.get('https://api.serpdog.io/shopping', params=payload)
print (resp.text)
```

{% endtab %}

{% tab title="Java" %}

```java
try {
 String url = "https://api.serpdog.io/shopping?api_key=APIKEY&q=shoes&gl=us";
 URL urlForGetRequest = new URL(url);
 String readLine = null;
 HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
 conection.setRequestMethod("GET");
 int responseCode = conection.getResponseCode();
 if (responseCode == HttpURLConnection.HTTP_OK) {
 BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
 StringBuffer response = new StringBuffer();
 while ((readLine = in.readLine()) != null) {
 response.append(readLine);
 }
 in.close();
 System.out.println(response.toString());
} else {
 throw new Exception("Error in API Call");
 }
} catch (Exception ex) {
 ex.printStackTrace();
}
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'
params = {
 :api_key => "APIKEY",
 :q=> "shoes",
 :gl => "us"
}
uri = URI('https://api.serpdog.io/shopping')
uri.query = URI.encode_www_form(params)
website_content = Net::HTTP.get(uri)
print(website_content)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = "https://api.serpdog.io/shopping?api_key=APIKEY&q=shoes&gl=us";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
```

{% endtab %}
{% endtabs %}

```json
{
  "meta": {
    "api_key": "APIKEY",
    "q": "shoes",
    "gl": "us"
  },
  "filters": [
    {
      "type": "Price",
      "options": [
        {
          "text": "Up to $10",
          "tbs": "mr:1,price:1,ppr_max:10"
        },
        {
          "text": "$10 – $25",
          "tbs": "mr:1,price:1,ppr_min:10,ppr_max:25"
        },
        {
          "text": "$25 – $50",
          "tbs": "mr:1,price:1,ppr_min:25,ppr_max:50"
        },
        {
          "text": "$50 – $100",
          "tbs": "mr:1,price:1,ppr_min:50,ppr_max:100"
        },
        {
          "text": "Over $100",
          "tbs": "mr:1,price:1,ppr_min:100"
        }
      ]
    },
    .....
   ],
   "ads": [
    {
      "position": 1,
      "title": "Jet Black (Medium and Extra Wide 4E Available) (Sizes 7-16) Medium (D) / 10.5CA$181.85",
      "link": "https://google.com/aclk?sa=l&ai=DChcSEwjm7dPx6dP5AhUYwsIEHen5B8YYABABGgJwdg&sig=AOD64_0NXIqqoLaeE0blf92DyNSXHBcK3A&ctype=5&q=&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQww8Irw4&adurl=",
      "source": "Zeba Shoes",
      "price": "CA$181.85",
      "thumbnail": "https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcR6bB7yuBN2zjyHSGupV7-aSSHq9mM25NO2UqpxlxY2Og4Wl5JoxkFGPGfnAgMxuVEUniRNFg1w6Ntw0ioJAkgR-EqGwPyb3jOQaxbuOOleyBWbQixVhNSp9w&usqp=CAE"
    },
    {
      "position": 2,
      "title": "Fish Slippers Beach Shoes Pool Non-Slip Sandals Men and Women Casual ShoeCA$28.00",
      "link": "https://google.com/aclk?sa=l&ai=DChcSEwjm7dPx6dP5AhUYwsIEHen5B8YYABADGgJwdg&sig=AOD64_0TRpjhmKzAxJtJ8hKCgv--zqOP-g&ctype=5&q=&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQww8Isg4&adurl=",
      "source": "Amazon CA",
      "price": "CA$28.00",
      "thumbnail": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQ2W85a9834g1ggN1S4UkccWY3cXT9H5TGO_vUm_F932Qw-kR1UAic73l0SUG4-SA-u7u6zlZ_7VxjF41mQX-55uAuNSh3wdr0hxPHNJXeW_bqbC6pU-2G4&usqp=CAE"
    },
    ....
    ],
    "shopping_results": [
    {
      "position": 1,
      "title": "Nike LeBron XVII Basketball Shoes (White) Size 11",
      "link": "https://www.goat.com/sneakers/lebron-17-air-command-force-bq3177-100%3Fsrsltid%3DAdGWZVQZVSDhUlCTAvb1HQ4hN3Q6FxUkHZZ1m3UPEgiSIkMo9-V7WMehk1c&rct=j&q=&esrc=s&sa=U&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQguUECMYO&usg=AOvVaw2bJdRrq4-ics8g0aX0LLYu",
      "product_link": "https://google.com/shopping/product/14214112555488983868?q=shoes&oq=shoes&gl=us&sourceid=chrome&ie=UTF-8&prds=eto:17557070689024820201_0,pid:6481879233016932111,rsk:PC_16928367288155928171&sa=X&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQ8wIIxA4",
      "product_id": "6481879233016932111",
      "source": "GOAT",
      "price": "$239.00",
      "rating": "4.6",
      "thumbnail": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
      "delivery": "$13.50 delivery",
      "extensions": "LOW PRICE"
    },
    {
      "position": 2,
      "title": "Converse Chuck Taylor All Star Classic High Top (White Size 13) Unisex Canvas Shoes",
      "link": "https://www.converse.com/shop/p/chuck-taylor-all-star-classic-unisex-high-top-shoe/171750F_130.html%3Fcp%3DPLA_PRF_CNV_NA_US_EN_20200429_CPCS_Surfaces_X_X_X_X_Google_X_X_194432988514_X_X_X&rct=j&q=&esrc=s&sa=U&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQguUECNYO&usg=AOvVaw1IOjq4GdI_OaSRpSxPriQ_",
      "product_link": "https://google.com/shopping/product/16525774757933753875?q=shoes&oq=shoes&gl=us&sourceid=chrome&ie=UTF-8&prds=eto:9965886655953646673_0,pid:10340401949653974827&sa=X&ved=0ahUKEwj4utDx6dP5AhWmIDQIHcjwC7QQ8wII1Q4",
      "product_id": "10340401949653974827",
      "source": "Converse",
      "price": "$65.00",
      "thumbnail": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
      "delivery": "Free delivery by Sep 6 & Free 30-day returns"
    },
    ....
    ],
}
```
