Shopify Fast Scraper

FREEMIUM
Door Ardechoft Inc | Bijgewerkt 2 महीने पहले | eCommerce
Populariteit

9.1 / 10

Latency

1,224ms

Serviceniveau

100%

Health Check

N/A

Terug naar alle tutorials (3)

Retrieve all the products from a collection

The first step is to find the URL of a Shopify collection. Usually a website is showing categories of products, each category is a collection. Nonetheless you can simply append /collections to the root URL of the website and you will get all the collections.

For instance for this shop: https://shop.flipperzero.one/ we can append /collections, we get: https://shop.flipperzero.one/collections. Opening it will show all the collections. Then you can click on one of the collection and will go on the collection page, all the products of the collection are listed.

If I click on the first one I go there: https://shop.flipperzero.one/collections/flipper-zero-accessories this is the collection URL. This is the link I am supposed to use as input of the collection endpoint. It must contains “/collections/” else it isn’t a collection link.

You can then use the API with this collection endpoint:

const axios = require('axios');

const options = {
  method: 'GET',
  url: 'https://shopify-fast-scraper.p.rapidapi.com/collection',
  params: {
    url: 'https://shop.flipperzero.one/collections/flipper-zero-accessories'
  },
  headers: {
    'X-RapidAPI-Key': '[YOUR KEY]',
    'X-RapidAPI-Host': 'shopify-fast-scraper.p.rapidapi.com'
  }
};

try {
	const response = await axios.request(options);
	console.log(response.data);
} catch (error) {
	console.error(error);
}

You will get the following response:

{
	"id": 292570267801,
	"title": "Flipper Zero Accessories",
	"handle": "flipper-zero-accessories",
	"description": "",
	"published_at": "2021-12-15T17:08:38Z",
	"updated_at": "2023-07-03T07:10:09Z",
	"image": null,
	"products_count": 4,
	"products": [{
			"id": 6146340520089,
			"title": "Silicone Case for Flipper Zero",
			"handle": "flipper-silicone-case",
			"body_html": "<p><strong>Protective Silicone Case for your Flipper Zero.</strong></p>\n<p>\"ФЛИППЕР\" means \"Flipper\" in Cyrillic. Soft and smooth, this \"ФЛИППЕР\" silicone case will make your cyber companion even stronger, preserving an astonishing look with a little touch of Russian vibe showing its roots.<br>&lt;meta charset=\"UTF-8\"&gt;</p>",
			"published_at": "2021-08-30T13:47:52Z",
			"created_at": "2021-02-11T17:45:12Z",
			"updated_at": "2023-07-03T07:05:04Z",
			"vendor": "Flipper Devices",
			"product_type": "Accessories",
			"tags": [],
			"variants": [...],
			"images": [...],
			"options": [{
				"name": "Title",
				"position": 1,
				"values": [
					"Default Title"
				]
			}]
		},
		...
	]
}

The collection data is returned: title, handle, description, … but also all the products from the collection. Each product contains the same data as what the /product endpoint would return.

Warning

If a collection has more than 500 products, only the url of the products are returned and not the full products data. For each product url the endpoint /product can then be used with the product url in order to get the full product data.

The result looks like:

"products": [
        "https://denydesigns.com/products/henrike-schenk-travel-photography-garden-of-daisy-flowers-framed-wall-art-1",
        "https://denydesigns.com/products/henrike-schenk-travel-photography-white-tulips-in-spring-in-holland-framed-wall-art-3",
        "https://denydesigns.com/products/henrike-schenk-travel-photography-sorrento-stripes-framed-wall-art-1",
				...
]

For each product url, the full detail of the product can be retrieved using the /product endpoint, a tutorial is available here.

The products_count property gives the number of product in the collection.

While using the API you can get some errors:

  • Is it a valid Shopify product url? If you believe it is send an email to support@ardechoft.com and we will solve the issue! -> Double check that the URL is indeed the url from a collection.
  • It seems you are trying to access lots of products for the same store and Shopify is rate limiting us. Use the /collection or /store endpoint to get the same products with less requests. Try again in a moment. -> It means two many requests to the same shop have been made, add some delay between two calls to the API.