Created
August 25, 2020 15:52
-
-
Save aarkerio/5f6c9e59dcf392ada1bc890126a3222a to your computer and use it in GitHub Desktop.
Shopify GraphQL API. Search products and its variants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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