Version: unstable
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { theme(id: \\\"gid://shopify/OnlineStoreTheme/225007463\\\") { id name role files(filenames: [\\\"assets/index.js\\\"], first: 1) { nodes { body { ... on OnlineStoreThemeFileBodyText { content } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files(filenames: [\"assets/index.js\"], first: 1) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\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 theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files(filenames: [\"assets/index.js\"], first: 1) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\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 theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files(filenames: [\"assets/index.js\"], first: 1) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files(filenames: [\"assets/index.js\"], first: 1) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n }\n }\n }\n }\n}"
input: null
response: { "data": { "theme": { "id": "gid://shopify/OnlineStoreTheme/225007463", "name": "Comfort", "role": "UNPUBLISHED", "files": { "nodes": [ { "body": { "content": "console.log('foo');" } } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { theme(id: \\\"gid://shopify/OnlineStoreTheme/529529152\\\") { id name role } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n theme(id: \"gid://shopify/OnlineStoreTheme/529529152\") {\n id\n name\n role\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 theme(id: \"gid://shopify/OnlineStoreTheme/529529152\") {\n id\n name\n role\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 theme(id: \"gid://shopify/OnlineStoreTheme/529529152\") {\n id\n name\n role\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n theme(id: \"gid://shopify/OnlineStoreTheme/529529152\") {\n id\n name\n role\n }\n}"
input: null
response: { "data": { "theme": { "id": "gid://shopify/OnlineStoreTheme/529529152", "name": "Comfort", "role": "MAIN" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { theme(id: \\\"gid://shopify/OnlineStoreTheme/225007463\\\") { id name role files { edges { node { filename body { ... on OnlineStoreThemeFileBodyText { content } } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files {\n edges {\n node {\n filename\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\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 theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files {\n edges {\n node {\n filename\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\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 theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files {\n edges {\n node {\n filename\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n theme(id: \"gid://shopify/OnlineStoreTheme/225007463\") {\n id\n name\n role\n files {\n edges {\n node {\n filename\n body {\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n }\n }\n }\n }\n }\n}"
input: null
response: { "data": { "theme": { "id": "gid://shopify/OnlineStoreTheme/225007463", "name": "Comfort", "role": "UNPUBLISHED", "files": { "edges": [ { "node": { "filename": "assets/index.js", "body": { "content": "console.log('foo');" } } }, { "node": { "filename": "assets/styles.css", "body": { "content": "p { color: red; }" } } }, { "node": { "filename": "layout/theme.liquid", "body": { "content": "{{ content_for_header }}sandbox
{{ content_for_layout }}" } } } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query ThemeFilesPaginated($themeId: ID!) { theme(id: $themeId) { files(first: 50) { edges { node { body { ... on OnlineStoreThemeFileBodyBase64 { contentBase64 } ... on OnlineStoreThemeFileBodyText { content } ... on OnlineStoreThemeFileBodyUrl { url } } checksumMd5 contentType createdAt filename size updatedAt } cursor } pageInfo { endCursor hasNextPage hasPreviousPage startCursor } userErrors { code filename } } } }\",\n \"variables\": {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ThemeFilesPaginated($themeId: ID!) {\n theme(id: $themeId) {\n files(first: 50) {\n edges {\n node {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n userErrors {\n code\n filename\n }\n }\n }\n }`,\n \"variables\": {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\"\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 ThemeFilesPaginated($themeId: ID!) {\n theme(id: $themeId) {\n files(first: 50) {\n edges {\n node {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n userErrors {\n code\n filename\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\"\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 = <<\"gid://shopify/OnlineStoreTheme/225007463\",\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 ThemeFilesPaginated($themeId: ID!) {\n theme(id: $themeId) {\n files(first: 50) {\n edges {\n node {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n userErrors {\n code\n filename\n }\n }\n }\n }`,\n {\n variables: {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ThemeFilesPaginated($themeId: ID!) {\n theme(id: $themeId) {\n files(first: 50) {\n edges {\n node {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n userErrors {\n code\n filename\n }\n }\n }\n}"
input: { "themeId": "gid://shopify/OnlineStoreTheme/225007463" }
response: { "data": { "theme": { "files": { "edges": [ { "node": { "body": { "content": "console.log('foo');" }, "checksumMd5": "fd33535a878f593c91bf93c7b39da272", "contentType": "application/javascript", "createdAt": "2024-10-30T22:18:48Z", "filename": "assets/index.js", "size": "19", "updatedAt": "2024-10-30T22:18:48Z" }, "cursor": "ImFzc2V0c1wvaW5kZXguanMi" }, { "node": { "body": { "content": "p { color: red; }" }, "checksumMd5": "5fc2748b49b0a877ea0bb50a105038ab", "contentType": "text/css", "createdAt": "2024-10-30T22:18:48Z", "filename": "assets/styles.css", "size": "17", "updatedAt": "2024-10-30T22:18:48Z" }, "cursor": "ImFzc2V0c1wvc3R5bGVzLmNzcyI=" }, { "node": { "body": { "content": "{{ content_for_header }}sandbox
{{ content_for_layout }}" }, "checksumMd5": null, "contentType": "application/x-liquid", "createdAt": "2010-07-12T19:31:50Z", "filename": "layout/theme.liquid", "size": "3252", "updatedAt": "2010-07-12T19:31:50Z" }, "cursor": "ImxheW91dFwvdGhlbWUubGlxdWlkIg==" } ], "pageInfo": { "endCursor": "ImxheW91dFwvdGhlbWUubGlxdWlkIg==", "hasNextPage": false, "hasPreviousPage": false, "startCursor": "ImFzc2V0c1wvaW5kZXguanMi" }, "userErrors": [] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query ThemeFiles($themeId: ID!, $filenames: [String!]!) { theme(id: $themeId) { files(filenames: $filenames) { nodes { body { ... on OnlineStoreThemeFileBodyBase64 { contentBase64 } ... on OnlineStoreThemeFileBodyText { content } ... on OnlineStoreThemeFileBodyUrl { url } } checksumMd5 contentType createdAt filename size updatedAt } userErrors { code filename } } } }\",\n \"variables\": {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\",\n \"filenames\": [\n \"assets/index.js\"\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ThemeFiles($themeId: ID!, $filenames: [String!]!) {\n theme(id: $themeId) {\n files(filenames: $filenames) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n userErrors {\n code\n filename\n }\n }\n }\n }`,\n \"variables\": {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\",\n \"filenames\": [\n \"assets/index.js\"\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 ThemeFiles($themeId: ID!, $filenames: [String!]!) {\n theme(id: $themeId) {\n files(filenames: $filenames) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n userErrors {\n code\n filename\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\",\n \"filenames\": [\"assets/index.js\"]\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 = <<\"gid://shopify/OnlineStoreTheme/225007463\",\n \"filenames\" => [\"assets/index.js\"],\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 ThemeFiles($themeId: ID!, $filenames: [String!]!) {\n theme(id: $themeId) {\n files(filenames: $filenames) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n userErrors {\n code\n filename\n }\n }\n }\n }`,\n {\n variables: {\n \"themeId\": \"gid://shopify/OnlineStoreTheme/225007463\",\n \"filenames\": [\n \"assets/index.js\"\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ThemeFiles($themeId: ID!, $filenames: [String!]!) {\n theme(id: $themeId) {\n files(filenames: $filenames) {\n nodes {\n body {\n ... on OnlineStoreThemeFileBodyBase64 {\n contentBase64\n }\n ... on OnlineStoreThemeFileBodyText {\n content\n }\n ... on OnlineStoreThemeFileBodyUrl {\n url\n }\n }\n checksumMd5\n contentType\n createdAt\n filename\n size\n updatedAt\n }\n userErrors {\n code\n filename\n }\n }\n }\n}"
input: { "themeId": "gid://shopify/OnlineStoreTheme/225007463", "filenames": [ "assets/index.js" ] }
response: { "data": { "theme": { "files": { "nodes": [ { "body": { "content": "console.log('foo');" }, "checksumMd5": "fd33535a878f593c91bf93c7b39da272", "contentType": "application/javascript", "createdAt": "2024-10-30T22:18:46Z", "filename": "assets/index.js", "size": "19", "updatedAt": "2024-10-30T22:18:46Z" } ], "userErrors": [] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query Theme($id: ID!) { theme(id: $id) { createdAt id name prefix processing processingFailed role themeStoreId updatedAt } }\",\n \"variables\": {\n \"id\": \"gid://shopify/OnlineStoreTheme/529529152\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query Theme($id: ID!) {\n theme(id: $id) {\n createdAt\n id\n name\n prefix\n processing\n processingFailed\n role\n themeStoreId\n updatedAt\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/OnlineStoreTheme/529529152\"\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 Theme($id: ID!) {\n theme(id: $id) {\n createdAt\n id\n name\n prefix\n processing\n processingFailed\n role\n themeStoreId\n updatedAt\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/OnlineStoreTheme/529529152\"\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 = <<\"gid://shopify/OnlineStoreTheme/529529152\",\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 Theme($id: ID!) {\n theme(id: $id) {\n createdAt\n id\n name\n prefix\n processing\n processingFailed\n role\n themeStoreId\n updatedAt\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/OnlineStoreTheme/529529152\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query Theme($id: ID!) {\n theme(id: $id) {\n createdAt\n id\n name\n prefix\n processing\n processingFailed\n role\n themeStoreId\n updatedAt\n }\n}"
input: { "id": "gid://shopify/OnlineStoreTheme/529529152" }
response: { "data": { "theme": { "createdAt": "2024-10-30T22:18:09Z", "id": "gid://shopify/OnlineStoreTheme/529529152", "name": "Comfort", "prefix": "/t/1", "processing": false, "processingFailed": false, "role": "MAIN", "themeStoreId": 1234, "updatedAt": "2024-10-30T22:18:09Z" } } }