Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { productVariant1: productVariant(id: \\\"gid://shopify/ProductVariant/30322695\\\") { id title } productVariant2: productVariant(id: \\\"gid://shopify/ProductVariant/43729076\\\") { id title } productVariant3: productVariant(id: \\\"gid://shopify/ProductVariant/113711323\\\") { id title } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n}"
input: null
response: { "data": { "productVariant1": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm" }, "productVariant2": { "id": "gid://shopify/ProductVariant/43729076", "title": "151cm" }, "productVariant3": { "id": "gid://shopify/ProductVariant/113711323", "title": "155cm" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { productVariants(first: 10) { edges { node { id } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n}"
input: null
response: { "data": { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/30322695" } }, { "node": { "id": "gid://shopify/ProductVariant/43729076" } }, { "node": { "id": "gid://shopify/ProductVariant/113711323" } }, { "node": { "id": "gid://shopify/ProductVariant/138327650" } }, { "node": { "id": "gid://shopify/ProductVariant/236948360" } }, { "node": { "id": "gid://shopify/ProductVariant/330284860" } }, { "node": { "id": "gid://shopify/ProductVariant/389013007" } }, { "node": { "id": "gid://shopify/ProductVariant/419425742" } }, { "node": { "id": "gid://shopify/ProductVariant/438458761" } }, { "node": { "id": "gid://shopify/ProductVariant/445365074" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { productVariants(first: 3, query: \\\"location_id:124656943\\\", sortKey: INVENTORY_LEVELS_AVAILABLE) { edges { node { id inventoryItem { inventoryLevel(locationId: \\\"gid://shopify/Location/124656943\\\") { quantities(names: \\\"available\\\") { quantity name } } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n}"
input: null
response: { "data": { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/419425742", "inventoryItem": { "inventoryLevel": { "quantities": [ { "quantity": 0, "name": "available" } ] } } } }, { "node": { "id": "gid://shopify/ProductVariant/30322695", "inventoryItem": { "inventoryLevel": { "quantities": [ { "quantity": 1, "name": "available" } ] } } } }, { "node": { "id": "gid://shopify/ProductVariant/43729076", "inventoryItem": { "inventoryLevel": { "quantities": [ { "quantity": 1, "name": "available" } ] } } } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { productVariants(first: 3, query: \\\"updated_at:>2021-01-01\\\") { edges { node { id title price updatedAt inventoryQuantity product { id title } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n}"
input: null
response: { "data": { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm", "price": "10.00", "updatedAt": "2021-11-11T11:11:11Z", "inventoryQuantity": 3, "product": { "id": "gid://shopify/Product/20995642", "title": "Element" } } }, { "node": { "id": "gid://shopify/ProductVariant/43729076", "title": "151cm", "price": "10.00", "updatedAt": "2021-11-11T11:11:11Z", "inventoryQuantity": 1, "product": { "id": "gid://shopify/Product/108828309", "title": "Draft" } } }, { "node": { "id": "gid://shopify/ProductVariant/113711323", "title": "155cm", "price": "15.00", "updatedAt": "2021-11-11T11:11:11Z", "inventoryQuantity": 15, "product": { "id": "gid://shopify/Product/20995642", "title": "Element" } } } ] } } }