# Myntra Search API

You have to send a GET request to **`https://api.scrapingdog.com/myntra/search`** with the below given parameters.

### Parameters

#### Scrapingdog 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>                                                                   |
| html                                                               | <p>This will return the full HTML of the Myntra page. <br><br>Default Value - <strong><code>false</code></strong> <br><br>Type - <strong><code>Boolean</code></strong></p> |

#### Search Query

| Parameter                                                     | Description                                                                            |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| <p>url<br></p><p><mark style="color:red;">required</mark></p> | <p>URL of the Myntra Searchh Page. <br><br>Type - <em><strong>String</strong></em></p> |

### API Example

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

```bash
curl "https://api.scrapingdog.com/myntra/search?api_key=APIKEY&url=https://www.myntra.com/nike-shoes?rawQuery=nike%20shoes"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.scrapingdog.com/myntra/search"
params = {
    "api_key": "APIKEY",
    "url": "https://www.myntra.com/nike-shoes?rawQuery=nike%20shoes",
}

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 url = 'https://api.scrapingdog.com/myntra/search';
const params = {
  api_key: 'APIKEY',
  url: 'https://www.myntra.com/nike-shoes?rawQuery=nike%20shoes'
};

axios
  .get(url, { params })
  .then((response) => {
    if (response.status === 200) {
      const data = response.data;
      console.log(data);
    } else {
      console.log(`Request failed with status code ${response.status}`);
    }
  })
  .catch((error) => {
    console.error('Request failed with an error:', error);
  });

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$apiUrl = 'https://api.scrapingdog.com/myntra/search';
$apiKey = 'APIKEY';
$url = 'https://www.myntra.com/nike-shoes?rawQuery=nike%20shoes';

$queryString = http_build_query([
    'api_key' => $apiKey,
    'url' => $url
]);

$fullUrl = $apiUrl . '?' . $queryString;

$ch = curl_init($fullUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($httpCode == 200) {
    $data = json_decode($response, true);
    print_r($data);
} else {
    echo "Request failed with status code $httpCode\n";
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'

api_url = 'https://api.scrapingdog.com/myntra/search'
api_key = 'APIKEY'
url = 'https://www.myntra.com/nike-shoes?rawQuery=nike%20shoes'

params = {
  'api_key' => api_key,
  'url' => url
}

uri = URI(api_url)
uri.query = URI.encode_www_form(params)

response = Net::HTTP.get_response(uri)

if response.is_a?(Net::HTTPSuccess)
  data = JSON.parse(response.body)
  puts data
else
  puts "Request failed with status code #{response.code}"
end

```

{% endtab %}

{% tab title="Java" %}

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

public class Main {
    public static void main(String[] args) {
        String apiURL = "https://api.scrapingdog.com/myntra/search";
        String apiKey = "APIKEY";
        String url = "https://www.myntra.com/nike-shoes?rawQuery=nike%20shoes";

        try {
            // Create the URL with query parameters
            URL url = new URL(apiURL + "?api_key=" + apiKey + "&url=" + 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 data
                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String line;
                StringBuilder response = new StringBuilder();

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

                // Print the response data
                System.out.println(response.toString());
            } else {
                System.out.println("Request failed with response code: " + responseCode);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

```

{% endtab %}
{% endtabs %}

### API Response

```json
{
    "search_results": [
        {
            "landingPageUrl": "sports-shoes/nike/nike-men-legend-essential-3-next-nature-workout-shoes/25503840/buy",
            "loyaltyPointsEnabled": false,
            "adId": "",
            "isPLA": false,
            "productId": 25503840,
            "product": "Nike Men Legend Essential 3 Next Nature Workout Shoes",
            "productName": "Nike Men Legend Essential 3 Next Nature Workout Shoes",
            "rating": 4.062858581542969,
            "ratingCount": 3659,
            "isFastFashion": false,
            "futureDiscountedPrice": 0,
            "futureDiscountStartDate": "",
            "discount": 0,
            "brand": "Nike",
            "searchImage": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/db142f36-9011-4774-8799-08f7685025b81697471896207NikeLegendEssentialMenWorkoutShoes1.jpg",
            "effectiveDiscountPercentageAfterTax": 0,
            "effectiveDiscountAmountAfterTax": 0,
            "buyButtonWinnerSkuId": 82270480,
            "buyButtonWinnerSellerPartnerId": 22534,
            "relatedStylesCount": 0,
            "relatedStylesType": "",
            "productVideos": [],
            "inventoryInfo": [
                {
                    "skuId": 82270480,
                    "label": "UK6",
                    "inventory": 1371,
                    "available": true,
                    "brandSizeLabel": "6"
                }
            ],
            "colourVariants": [],
            "sizes": "5,6,7,8,9,10,11,12",
            "images": [
                {
                    "view": "default",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/db142f36-9011-4774-8799-08f7685025b81697471896207NikeLegendEssentialMenWorkoutShoes1.jpg"
                },
                {
                    "view": "search",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/db142f36-9011-4774-8799-08f7685025b81697471896207NikeLegendEssentialMenWorkoutShoes1.jpg"
                },
                {
                    "view": "left",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/ebe024a1-2c29-4780-a0aa-15766a77b3d01697471896180NikeLegendEssentialMenWorkoutShoes5.jpg"
                },
                {
                    "view": "bottom",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/10cb560b-1df4-41fb-9fed-5500a73144551697471896202NikeLegendEssentialMenWorkoutShoes7.jpg"
                },
                {
                    "view": "top",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/31ce0e56-1987-407a-9fef-58fb1ade56e71697471896213NikeLegendEssentialMenWorkoutShoes6.jpg"
                },
                {
                    "view": "back",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/9cbbb013-eaeb-4a44-b27a-6b39155e7a2b1697471896197NikeLegendEssentialMenWorkoutShoes3.jpg"
                },
                {
                    "view": "size_representation",
                    "src": ""
                },
                {
                    "view": "right",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/b81c404d-0265-47fa-95e6-63751774bb941697471896192NikeLegendEssentialMenWorkoutShoes4.jpg"
                },
                {
                    "view": "front",
                    "src": "http://assets.myntassets.com/assets/images/25503840/2023/10/16/45d20348-4dbf-49ce-ba07-74eec4dffdae1697471896187NikeLegendEssentialMenWorkoutShoes2.jpg"
                }
            ],
            "gender": "Men",
            "primaryColour": "Black",
            "discountLabel": "Flat_Search_Amount",
            "discountDisplayLabel": "",
            "additionalInfo": "Men Next Nature Workout Shoes",
            "category": "Sports Shoes",
            "mrp": 4995,
            "price": 4995,
            "advanceOrderTag": "",
            "colorVariantAvailable": true,
            "productimagetag": "",
            "listViews": 0,
            "discountType": "1",
            "tdBxGyText": "",
            "catalogDate": "1697068800000",
            "season": "Winter",
            "year": "2023",
            "isPersonalised": false,
            "eorsPicksTag": "",
            "personalizedCoupon": "",
            "personalizedCouponValue": 0,
            "productMeta": "",
            "systemAttributes": [
                {
                    "attribute": "SA_XT_STYLEBOOST",
                    "value": "NA",
                    "metaInfo": ""
                },
                {
                    "attribute": "isGSTiN",
                    "value": "True",
                    "metaInfo": ""
                }
            ],
            "attributeTagsPriorityList": [],
            "preferredDeliveryTag": "",
            "deliveryPromise": "",
            "expressTags": [],
            "couponData": {
                "couponDiscount": 300,
                "endDate": "1782797700000",
                "tagLink": "https://www.myntra.com/online-fashion-store",
                "couponDescription": {
                    "description": "{bestPriceText} {bestPrice} with coupon",
                    "couponCode": "MYNTRA300",
                    "bestPrice": 4695,
                    "bestPriceText": "Best Price",
                    "templateInfo": {
                        "templateName": "template1",
                        "attributes": {
                            "couponDiscount": "",
                            "couponCode": "identifier1",
                            "bestPrice": "identifier1",
                            "bestPriceText": "identifier1"
                        }
                    }
                }
            },
            "productMetaData": {
                "plaSlot": false,
                "plaSlotType": "",
                "plaReason": "",
                "plaRank": 0,
                "adSource": "",
                "adsMeta": null,
                "lmsMetadata": "",
                "isUld": false,
                "organicMeta": {
                    "metasrcDsExplore": "",
                    "metasrcDsCohort": "",
                    "metasrcDsFwdCohort": "",
                    "exploreReason": "",
                    "exploreSlot": false,
                    "isExplore": false
                },
                "instrumentationMetaData": {}
            },
            "virtualTryOn": {
                "vtrPartner": ""
            },
            "vtrApplicable": false,
            "articleType": {
                "typeName": "Sports Shoes"
            },
            "subCategory": {
                "typeName": "Shoes"
            },
            "masterCategory": {
                "typeName": "Footwear"
            },
            "mediaData": [],
            "hasMultipleSizes": true,
            "relatedColoursCount": 14,
            "styleTagEntry": {
                "tagGroups": {
                    "attributeTags": {},
                    "miscTags": {
                        "tagInfos": [
                            {
                                "tagId": "High_Performing"
                            },
                            {
                                "metadata": {
                                    "article_type": "Sports Shoes",
                                    "commission_source": "article_type",
                                    "commission_tag": "Commission_11"
                                },
                                "name": "YT_Commission_Tag",
                                "tagId": "YT_Commission_Tag"
                            }
                        ]
                    },
                    "pricing": {
                        "tagInfos": [
                            {
                                "name": "Crazy Deals",
                                "tagId": "Crazy_Deals"
                            },
                            {
                                "name": "Festive Price Crash",
                                "tagId": "Festive_Price_Crash"
                            },
                            {
                                "name": "Crazy Deal",
                                "tagId": "Crazy_Deal"
                            },
                            {
                                "name": "Festive Price Drop",
                                "tagId": "Festive_Price_Drop"
                            }
                        ]
                    },
                    "selection": {},
                    "socialProofing": {
                        "tagInfos": [
                            {
                                "metadata": {
                                    "count": "64"
                                },
                                "tagId": "Add_To_Cart"
                            },
                            {
                                "metadata": {
                                    "count": "1517"
                                },
                                "tagId": "PDP_Views"
                            }
                        ]
                    },
                    "trends": {},
                    "trust": {
                        "tagInfos": [
                            {
                                "metadata": {
                                    "articleType": "Sports Shoes",
                                    "attributeType": "Sport",
                                    "attributeValue": "Training or Gym",
                                    "quantity": "2760",
                                    "rank": "1"
                                },
                                "name": "Top N Bestseller",
                                "tagId": "topnBestseller"
                            }
                        ]
                    }
                }
            },
            "brandLogo": "https://assets.myntassets.com/assets/images/2020/4/9/818fc2ee-22b0-45a5-a14a-3aad42f4834a1586410578239-Logo.png",
            "rankingSource": null,
            "serviceableSizes": "",
            "saleInfo": null,
            "source": "others-search",
            "nepData": null
        },
   .....
]
```


---

# 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/myntra-scraper-api/myntra-search-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.
