fetching all media using products GraphQL

Highlighted
Shopify Partner
23 0 6

Hey guys,

I'm migrating my 'products' request from REST to GraphQL.

While in REST I used to get all the products' images in the response, in GraphQL I need to specify the amount of media (first/last).


Is there a way to get all products' media in GraphQL without exceeding query cost of 1000, and without paginating on media in each product?

0 Likes
Highlighted
Excursionist
18 3 2

Hi, there is no way to get all in one request.
You need to paginate.

0 Likes
Highlighted
Shopify Partner
23 0 6

You can actually make one GQL request for the product ids (paginated), and then another REST request with the product ids to get all the data (not paginated).

0 Likes
Highlighted
New Member
5 0 0

Take a look at this, it uses Python + GraphQL + Pagination to get orders, you can convert the GraphQL query to get Products instead.

 

https://github.com/mardambey/shopify-python-graphql-pagination

0 Likes