Exporting products from Shopify through storefront URL

Good afternoon everyone,

So, in my current implementation of Celigo, I need to integrate hundreds of Shopify shops products into a single multi-language (English & French) eCommerce platform. Those of you who know Shopify know that getting translated product data through its REST API is a hassle. 

So the approach I've chosen is that I use the Shopify Shop REST API to pull the product data in the shop's "main language". Which is most often French.

https://{{store_name}}/admin/api/{{api_version}}/products.json

Then, I need to pull the data in the other language (English). To do so, instead of trying to figure out which translation strategy the shop is using and which API I need to use (in the Shopify world, there are many approaches), I try to pull the product data from the storefront URL : 

https://{{store_name}}/{{locale}}/collections/all/products.json?limit=20&page={{export.http.paging.page}}

So far, this works fine. I get the data I want into Celigo. The issue is the following.

I've found no way of obtaining the total number of pages. The absence of this information does not prevent the export from running BUT it returns two errors : 

I've found no way of solving these errors. So I've opted to include a preSavePage script that loops through eventual errors and simply removes these two when they occur. Not graceful I will admit.

How would you tackle this situation? Ideally, I would find a way to prevent these errors from occurring in the first place

Thanks again for your support

0

Comments

2 comments
Date Votes
  • Have you tried using the following paging method? I am not familiar with this specific shopify API, but their other APIs use the link header paging pattern. Assuming this paging method works, then you should not need to set '&page=' in the relative uri too.

    0
  • Good morning everyone,

    Following up on my post, I tried the "link header" approach. It did not work as there it always returned only 1 page of results.

    Using the "page number parameter" option and discarding the errors was the sole method that allowed me to fetch all the product data needed

    Regards

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post