Version: 2024-04
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { products(first: 10, after: \\\"eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=\\\") { edges { node { id title handle } cursor } pageInfo { hasNextPage } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n products(first: 10, after: \"eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=\") {\n edges {\n node {\n id\n title\n handle\n }\n cursor\n }\n pageInfo {\n hasNextPage\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 products(first: 10, after: \"eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=\") {\n edges {\n node {\n id\n title\n handle\n }\n cursor\n }\n pageInfo {\n hasNextPage\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\n query {\n products(first: 10, after: \"eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=\") {\n edges {\n node {\n id\n title\n handle\n }\n cursor\n }\n pageInfo {\n hasNextPage\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 products(first: 10, after: \"eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=\") {\n edges {\n node {\n id\n title\n handle\n }\n cursor\n }\n pageInfo {\n hasNextPage\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n products(first: 10, after: \"eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=\") {\n edges {\n node {\n id\n title\n handle\n }\n cursor\n }\n pageInfo {\n hasNextPage\n }\n }\n}"
input: null
response: { "data": { "products": { "edges": [ { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft", "handle": "draft" }, "cursor": "eyJsYXN0X2lkIjoxMDg4MjgzMDksImxhc3RfdmFsdWUiOiIxMDg4MjgzMDkifQ==" }, { "node": { "id": "gid://shopify/Product/121709582", "title": "Boots", "handle": "boots" }, "cursor": "eyJsYXN0X2lkIjoxMjE3MDk1ODIsImxhc3RfdmFsdWUiOiIxMjE3MDk1ODIifQ==" }, { "node": { "id": "gid://shopify/Product/440089423", "title": "IPod Nano - 8GB", "handle": "ipod-nano" }, "cursor": "eyJsYXN0X2lkIjo0NDAwODk0MjMsImxhc3RfdmFsdWUiOiI0NDAwODk0MjMifQ==" }, { "node": { "id": "gid://shopify/Product/558169081", "title": "Unpublished Boots", "handle": "unpublished_boots" }, "cursor": "eyJsYXN0X2lkIjo1NTgxNjkwODEsImxhc3RfdmFsdWUiOiI1NTgxNjkwODEifQ==" }, { "node": { "id": "gid://shopify/Product/910489600", "title": "Crafty Shoes", "handle": "crappy-shoes" }, "cursor": "eyJsYXN0X2lkIjo5MTA0ODk2MDAsImxhc3RfdmFsdWUiOiI5MTA0ODk2MDAifQ==" }, { "node": { "id": "gid://shopify/Product/912855135", "title": "SEO Boots", "handle": "seo_boots" }, "cursor": "eyJsYXN0X2lkIjo5MTI4NTUxMzUsImxhc3RfdmFsdWUiOiI5MTI4NTUxMzUifQ==" } ], "pageInfo": { "hasNextPage": false } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { newestProducts: products(first: 5, reverse: true) { edges { node { id title } } } oldestProducts: products(first: 5) { edges { node { id title } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n newestProducts: products(first: 5, reverse: true) {\n edges {\n node {\n id\n title\n }\n }\n }\n oldestProducts: products(first: 5) {\n edges {\n node {\n id\n title\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 newestProducts: products(first: 5, reverse: true) {\n edges {\n node {\n id\n title\n }\n }\n }\n oldestProducts: products(first: 5) {\n edges {\n node {\n id\n title\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\n query {\n newestProducts: products(first: 5, reverse: true) {\n edges {\n node {\n id\n title\n }\n }\n }\n oldestProducts: products(first: 5) {\n edges {\n node {\n id\n title\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 newestProducts: products(first: 5, reverse: true) {\n edges {\n node {\n id\n title\n }\n }\n }\n oldestProducts: products(first: 5) {\n edges {\n node {\n id\n title\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n newestProducts: products(first: 5, reverse: true) {\n edges {\n node {\n id\n title\n }\n }\n }\n oldestProducts: products(first: 5) {\n edges {\n node {\n id\n title\n }\n }\n }\n}"
input: null
response: { "data": { "newestProducts": { "edges": [ { "node": { "id": "gid://shopify/Product/912855135", "title": "SEO Boots" } }, { "node": { "id": "gid://shopify/Product/910489600", "title": "Crafty Shoes" } }, { "node": { "id": "gid://shopify/Product/558169081", "title": "Unpublished Boots" } }, { "node": { "id": "gid://shopify/Product/440089423", "title": "IPod Nano - 8GB" } }, { "node": { "id": "gid://shopify/Product/121709582", "title": "Boots" } } ] }, "oldestProducts": { "edges": [ { "node": { "id": "gid://shopify/Product/20995642", "title": "Element" } }, { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft" } }, { "node": { "id": "gid://shopify/Product/121709582", "title": "Boots" } }, { "node": { "id": "gid://shopify/Product/440089423", "title": "IPod Nano - 8GB" } }, { "node": { "id": "gid://shopify/Product/558169081", "title": "Unpublished Boots" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { products(first: 10, reverse: true) { edges { node { id title handle resourcePublicationOnCurrentPublication { publication { name id } publishDate isPublished } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n products(first: 10, reverse: true) {\n edges {\n node {\n id\n title\n handle\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\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 products(first: 10, reverse: true) {\n edges {\n node {\n id\n title\n handle\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\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\n query {\n products(first: 10, reverse: true) {\n edges {\n node {\n id\n title\n handle\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\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 products(first: 10, reverse: true) {\n edges {\n node {\n id\n title\n handle\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n products(first: 10, reverse: true) {\n edges {\n node {\n id\n title\n handle\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\n }\n }\n }\n }\n}"
input: null
response: { "data": { "products": { "edges": [ { "node": { "id": "gid://shopify/Product/912855135", "title": "SEO Boots", "handle": "seo_boots", "resourcePublicationOnCurrentPublication": null } }, { "node": { "id": "gid://shopify/Product/910489600", "title": "Crafty Shoes", "handle": "crappy-shoes", "resourcePublicationOnCurrentPublication": null } }, { "node": { "id": "gid://shopify/Product/558169081", "title": "Unpublished Boots", "handle": "unpublished_boots", "resourcePublicationOnCurrentPublication": null } }, { "node": { "id": "gid://shopify/Product/440089423", "title": "IPod Nano - 8GB", "handle": "ipod-nano", "resourcePublicationOnCurrentPublication": null } }, { "node": { "id": "gid://shopify/Product/121709582", "title": "Boots", "handle": "boots", "resourcePublicationOnCurrentPublication": null } }, { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft", "handle": "draft", "resourcePublicationOnCurrentPublication": { "publication": { "name": "Generic Channel", "id": "gid://shopify/Publication/762454635" }, "publishDate": "2005-01-02T00:00:00Z", "isPublished": true } } }, { "node": { "id": "gid://shopify/Product/20995642", "title": "Element", "handle": "element", "resourcePublicationOnCurrentPublication": null } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { products(first: 10, query: \\\"product_type:snowboards\\\") { edges { node { title } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n products(first: 10, query: \"product_type:snowboards\") {\n edges {\n node {\n title\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 products(first: 10, query: \"product_type:snowboards\") {\n edges {\n node {\n title\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\n query {\n products(first: 10, query: \"product_type:snowboards\") {\n edges {\n node {\n title\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 products(first: 10, query: \"product_type:snowboards\") {\n edges {\n node {\n title\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n products(first: 10, query: \"product_type:snowboards\") {\n edges {\n node {\n title\n }\n }\n }\n}"
input: null
response: { "data": { "products": { "edges": [ { "node": { "title": "Element" } }, { "node": { "title": "Draft" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { products(first: 10, query: \\\"updated_at:>2019-12-01\\\") { edges { node { id updatedAt } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n products(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\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 products(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\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\n query {\n products(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\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 products(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n products(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\n }\n }\n }\n}"
input: null
response: { "data": { "products": { "edges": [ { "node": { "id": "gid://shopify/Product/440089423", "updatedAt": "2021-12-01T12:14:52Z" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { Glasses: product(id: \\\"gid://shopify/Product/20995642\\\") { ...productInformation } Shoes: product(id: \\\"gid://shopify/Product/910489600\\\") { ...productInformation } Bracelet: product(id: \\\"gid://shopify/Product/108828309\\\") { ...productInformation } } fragment productInformation on Product { totalInventory priceRange { minVariantPrice { amount } maxVariantPrice { amount } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n Glasses: product(id: \"gid://shopify/Product/20995642\") {\n ...productInformation\n }\n Shoes: product(id: \"gid://shopify/Product/910489600\") {\n ...productInformation\n }\n Bracelet: product(id: \"gid://shopify/Product/108828309\") {\n ...productInformation\n }\n }\n \n fragment productInformation on Product {\n totalInventory\n priceRange {\n minVariantPrice {\n amount\n }\n maxVariantPrice {\n amount\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 Glasses: product(id: \"gid://shopify/Product/20995642\") {\n ...productInformation\n }\n Shoes: product(id: \"gid://shopify/Product/910489600\") {\n ...productInformation\n }\n Bracelet: product(id: \"gid://shopify/Product/108828309\") {\n ...productInformation\n }\n }\n \n fragment productInformation on Product {\n totalInventory\n priceRange {\n minVariantPrice {\n amount\n }\n maxVariantPrice {\n amount\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\n query {\n Glasses: product(id: \"gid://shopify/Product/20995642\") {\n ...productInformation\n }\n Shoes: product(id: \"gid://shopify/Product/910489600\") {\n ...productInformation\n }\n Bracelet: product(id: \"gid://shopify/Product/108828309\") {\n ...productInformation\n }\n }\n \n fragment productInformation on Product {\n totalInventory\n priceRange {\n minVariantPrice {\n amount\n }\n maxVariantPrice {\n amount\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 Glasses: product(id: \"gid://shopify/Product/20995642\") {\n ...productInformation\n }\n Shoes: product(id: \"gid://shopify/Product/910489600\") {\n ...productInformation\n }\n Bracelet: product(id: \"gid://shopify/Product/108828309\") {\n ...productInformation\n }\n }\n \n fragment productInformation on Product {\n totalInventory\n priceRange {\n minVariantPrice {\n amount\n }\n maxVariantPrice {\n amount\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n Glasses: product(id: \"gid://shopify/Product/20995642\") {\n ...productInformation\n }\n Shoes: product(id: \"gid://shopify/Product/910489600\") {\n ...productInformation\n }\n Bracelet: product(id: \"gid://shopify/Product/108828309\") {\n ...productInformation\n }\n}\n\nfragment productInformation on Product {\n totalInventory\n priceRange {\n minVariantPrice {\n amount\n }\n maxVariantPrice {\n amount\n }\n }\n}"
input: null
response: { "data": { "Glasses": { "totalInventory": 19, "priceRange": { "minVariantPrice": { "amount": "1000.0" }, "maxVariantPrice": { "amount": "1500.0" } } }, "Shoes": { "totalInventory": 4000, "priceRange": { "minVariantPrice": { "amount": "10000.0" }, "maxVariantPrice": { "amount": "10000.0" } } }, "Bracelet": { "totalInventory": 1, "priceRange": { "minVariantPrice": { "amount": "1000.0" }, "maxVariantPrice": { "amount": "1000.0" } } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { glasses: product(id: \\\"gid://shopify/Product/108828309\\\") { title description } shoes: product(id: \\\"gid://shopify/Product/910489600\\\") { title description } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n glasses: product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n }\n shoes: product(id: \"gid://shopify/Product/910489600\") {\n title\n description\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 glasses: product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n }\n shoes: product(id: \"gid://shopify/Product/910489600\") {\n title\n description\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\n query {\n glasses: product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n }\n shoes: product(id: \"gid://shopify/Product/910489600\") {\n title\n description\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 glasses: product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n }\n shoes: product(id: \"gid://shopify/Product/910489600\") {\n title\n description\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n glasses: product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n }\n shoes: product(id: \"gid://shopify/Product/910489600\") {\n title\n description\n }\n}"
input: null
response: { "data": { "glasses": { "title": "Cool Glasses", "description": "Cool Glasses" }, "shoes": { "title": "Crafty Shoes", "description": "Crafty Shoes" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query ProductList { products(first: 2) { nodes { publishedOnCurrentPublication id } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\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 ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\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\n query ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\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 ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\n }\n }\n}"
input: null
response: { "data": { "products": { "nodes": [ { "publishedOnCurrentPublication": true, "id": "gid://shopify/Product/20995642" }, { "publishedOnCurrentPublication": true, "id": "gid://shopify/Product/108828309" } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query GetProducts { products(first: 10) { nodes { id title } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query GetProducts {\n products(first: 10) {\n nodes {\n id\n title\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 GetProducts {\n products(first: 10) {\n nodes {\n id\n title\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\n query GetProducts {\n products(first: 10) {\n nodes {\n id\n title\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 GetProducts {\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query GetProducts {\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n}"
input: null
response: { "data": { "products": { "nodes": [ { "id": "gid://shopify/Product/20995642", "title": "Element" }, { "id": "gid://shopify/Product/108828309", "title": "Draft" }, { "id": "gid://shopify/Product/121709582", "title": "Boots" }, { "id": "gid://shopify/Product/440089423", "title": "IPod Nano - 8GB" }, { "id": "gid://shopify/Product/558169081", "title": "Unpublished Boots" }, { "id": "gid://shopify/Product/910489600", "title": "Crafty Shoes" }, { "id": "gid://shopify/Product/912855135", "title": "SEO Boots" } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query ProductList { products(first: 2) { nodes { publishedOnCurrentPublication id createdAt updatedAt descriptionHtml handle productType title vendor tags publishedAt variants(first: 10) { nodes { id } } images(first: 10) { nodes { id height width url } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\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 ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\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\n query ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\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 ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductList {\n products(first: 2) {\n nodes {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\n }\n }\n }\n }\n}"
input: null
response: { "data": { "products": { "nodes": [ { "publishedOnCurrentPublication": true, "id": "gid://shopify/Product/20995642", "createdAt": "2005-01-01T00:00:00Z", "updatedAt": "2005-01-01T00:00:00Z", "descriptionHtml": "<p>bad board</p>", "handle": "element", "productType": "Snowboards", "title": "Element", "vendor": "Arbor", "tags": [], "publishedAt": "2005-01-01T00:00:00Z", "variants": { "nodes": [ { "id": "gid://shopify/ProductVariant/30322695" }, { "id": "gid://shopify/ProductVariant/113711323" }, { "id": "gid://shopify/ProductVariant/236948360" } ] }, "images": { "nodes": [ { "id": "gid://shopify/ProductImage/916933471", "height": 400, "width": 85, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/element58.jpg?v=1733171181" }, { "id": "gid://shopify/ProductImage/671149505", "height": 110, "width": 372, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/bacon.jpg?v=1733171181" } ] } }, { "publishedOnCurrentPublication": true, "id": "gid://shopify/Product/108828309", "createdAt": "2005-01-02T00:00:00Z", "updatedAt": "2005-01-02T00:00:00Z", "descriptionHtml": "<p>good board</p>", "handle": "draft", "productType": "Snowboards", "title": "Draft", "vendor": "Arbor", "tags": [ "Deepsnow", "Dub Quote\"s", "quote's", "Wooden Core" ], "publishedAt": "2005-01-02T00:00:00Z", "variants": { "nodes": [ { "id": "gid://shopify/ProductVariant/43729076" } ] }, "images": { "nodes": [ { "id": "gid://shopify/ProductImage/183532652", "height": 400, "width": 85, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1733171181" }, { "id": "gid://shopify/ProductImage/731367280", "height": 400, "width": 85, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1733171181" } ] } } ] } } }