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 { scriptTags(first: 5) { edges { node { id } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n scriptTags(first: 5) {\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 scriptTags(first: 5) {\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\n query {\n scriptTags(first: 5) {\n edges {\n node {\n id\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 scriptTags(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n scriptTags(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n}"
input: null
response: { "data": { "scriptTags": { "edges": [ { "node": { "id": "gid://shopify/ScriptTag/193372190" } }, { "node": { "id": "gid://shopify/ScriptTag/408148298" } }, { "node": { "id": "gid://shopify/ScriptTag/466217408" } }, { "node": { "id": "gid://shopify/ScriptTag/558170166" } }, { "node": { "id": "gid://shopify/ScriptTag/764371933" } } ] } } }
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 { scriptTags(first: 1, src: \\\"https://js.example.org/foo.js\\\") { edges { node { id } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n scriptTags(first: 1, src: \"https://js.example.org/foo.js\") {\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 scriptTags(first: 1, src: \"https://js.example.org/foo.js\") {\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\n query {\n scriptTags(first: 1, src: \"https://js.example.org/foo.js\") {\n edges {\n node {\n id\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 scriptTags(first: 1, src: \"https://js.example.org/foo.js\") {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n scriptTags(first: 1, src: \"https://js.example.org/foo.js\") {\n edges {\n node {\n id\n }\n }\n }\n}"
input: null
response: { "data": { "scriptTags": { "edges": [ { "node": { "id": "gid://shopify/ScriptTag/466217408" } } ] } } }
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 GetScriptTags($first: Int!, $cursor: String) { scriptTags(first: $first, after: $cursor) { nodes { id cache createdAt displayScope src updatedAt } pageInfo { startCursor endCursor } } }\",\n \"variables\": {\n \"first\": 5,\n \"cursor\": null\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GetScriptTags($first: Int!, $cursor: String) {\n scriptTags(first: $first, after: $cursor) {\n nodes {\n id\n cache\n createdAt\n displayScope\n src\n updatedAt\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }`,\n \"variables\": {\n \"first\": 5,\n \"cursor\": null\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 GetScriptTags($first: Int!, $cursor: String) {\n scriptTags(first: $first, after: $cursor) {\n nodes {\n id\n cache\n createdAt\n displayScope\n src\n updatedAt\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }\nQUERY\n\nvariables = {\n \"first\": 5,\n \"cursor\": nil\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query GetScriptTags($first: Int!, $cursor: String) {\n scriptTags(first: $first, after: $cursor) {\n nodes {\n id\n cache\n createdAt\n displayScope\n src\n updatedAt\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }\nQUERY;\n\n$variables = [\n \"first\" => 5,\n \"cursor\" => null,\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query GetScriptTags($first: Int!, $cursor: String) {\n scriptTags(first: $first, after: $cursor) {\n nodes {\n id\n cache\n createdAt\n displayScope\n src\n updatedAt\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }`,\n {\n variables: {\n \"first\": 5,\n \"cursor\": null\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GetScriptTags($first: Int!, $cursor: String) {\n scriptTags(first: $first, after: $cursor) {\n nodes {\n id\n cache\n createdAt\n displayScope\n src\n updatedAt\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n}"
input: { "first": 5, "cursor": null }
response: { "data": { "scriptTags": { "nodes": [ { "id": "gid://shopify/ScriptTag/193372190", "cache": false, "createdAt": "2024-10-29T22:38:08Z", "displayScope": "ONLINE_STORE", "src": "https://js.example.org/online_store.js", "updatedAt": "2024-10-29T22:38:08Z" }, { "id": "gid://shopify/ScriptTag/408148298", "cache": false, "createdAt": "2024-10-29T22:38:08Z", "displayScope": "ALL", "src": "https://protocol-relative.com/foo.js", "updatedAt": "2024-10-29T22:38:08Z" }, { "id": "gid://shopify/ScriptTag/466217408", "cache": false, "createdAt": "2024-10-29T22:38:08Z", "displayScope": "ALL", "src": "https://js.example.org/foo.js", "updatedAt": "2024-10-29T22:38:08Z" }, { "id": "gid://shopify/ScriptTag/558170166", "cache": false, "createdAt": "2024-10-29T22:38:08Z", "displayScope": "ALL", "src": "https://js.example.org/bar.js?bar=baz", "updatedAt": "2024-10-29T22:38:08Z" }, { "id": "gid://shopify/ScriptTag/764371933", "cache": false, "createdAt": "2024-10-29T22:38:08Z", "displayScope": "ALL", "src": "https://secure-js.example.org/bar.js?bar=baz", "updatedAt": "2024-10-29T22:38:08Z" } ], "pageInfo": { "startCursor": "eyJsYXN0X2lkIjoxOTMzNzIxOTAsImxhc3RfdmFsdWUiOiIxOTMzNzIxOTAifQ==", "endCursor": "eyJsYXN0X2lkIjo3NjQzNzE5MzMsImxhc3RfdmFsdWUiOiI3NjQzNzE5MzMifQ==" } } } }