Skip to content

Instantly share code, notes, and snippets.

@aarkerio
Created August 25, 2020 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarkerio/5f6c9e59dcf392ada1bc890126a3222a to your computer and use it in GitHub Desktop.
Save aarkerio/5f6c9e59dcf392ada1bc890126a3222a to your computer and use it in GitHub Desktop.
Shopify GraphQL API. Search products and its variants
query = %{ { products(first: 20, query: "title:*bik*")
{ edges { node { id
title
priceRange { maxVariantPrice { amount } minVariantPrice { amount } }
featuredImage { transformedSrc altText }
variants(first:10) { edges { node { id title price } } } } } } } }
url = 'https://dev-store-rdigital.myshopify.com/admin/api/2020-07/graphql.json'
def api_headers
{
'Content-type' => 'application/json',
'X-Shopify-Access-Token' => api_token
}
end
HTTParty.post(url, headers: shop.api_headers, body: { query: query, variables: ''}.to_json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment