Version: 2025-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { collection(id: \\\"gid://shopify/Collection/841564295\\\") { id title handle updatedAt } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n collection(id: \"gid://shopify/Collection/841564295\") {\n id\n title\n handle\n updatedAt\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 collection(id: \"gid://shopify/Collection/841564295\") {\n id\n title\n handle\n updatedAt\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 collection(id: \"gid://shopify/Collection/841564295\") {\n id\n title\n handle\n updatedAt\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 collection(id: \"gid://shopify/Collection/841564295\") {\n id\n title\n handle\n updatedAt\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n collection(id: \"gid://shopify/Collection/841564295\") {\n id\n title\n handle\n updatedAt\n }\n}"
input: null
response: { "data": { "collection": { "id": "gid://shopify/Collection/841564295", "title": "IPods", "handle": "ipods", "updatedAt": "2008-02-02T00:00:00Z" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CollectionMetafield($namespace: String!, $key: String!, $ownerId: ID!) { collection(id: $ownerId) { subtitle: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"subtitle\",\n \"ownerId\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CollectionMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n collection(id: $ownerId) {\n subtitle: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"subtitle\",\n \"ownerId\": \"gid://shopify/Collection/841564295\"\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 CollectionMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n collection(id: $ownerId) {\n subtitle: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"my_fields\",\n \"key\": \"subtitle\",\n \"ownerId\": \"gid://shopify/Collection/841564295\"\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 CollectionMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n collection(id: $ownerId) {\n subtitle: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY;\n\n$variables = [\n \"namespace\" => \"my_fields\",\n \"key\" => \"subtitle\",\n \"ownerId\" => \"gid://shopify/Collection/841564295\",\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 CollectionMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n collection(id: $ownerId) {\n subtitle: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"my_fields\",\n \"key\": \"subtitle\",\n \"ownerId\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CollectionMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n collection(id: $ownerId) {\n subtitle: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}"
input: { "namespace": "my_fields", "key": "subtitle", "ownerId": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "subtitle": { "value": "Best of the best" } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CollectionMetafields($ownerId: ID!) { collection(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\n \"ownerId\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CollectionMetafields($ownerId: ID!) {\n collection(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"ownerId\": \"gid://shopify/Collection/841564295\"\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 CollectionMetafields($ownerId: ID!) {\n collection(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"ownerId\": \"gid://shopify/Collection/841564295\"\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 CollectionMetafields($ownerId: ID!) {\n collection(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"ownerId\" => \"gid://shopify/Collection/841564295\",\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 CollectionMetafields($ownerId: ID!) {\n collection(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"ownerId\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CollectionMetafields($ownerId: ID!) {\n collection(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}"
input: { "ownerId": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "subtitle", "value": "Best of the best" } } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CollectionMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) { collection(id: $ownerId) { metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) { edges { node { name namespace key type { name } } } } } }\",\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Collection/841564295\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CollectionMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n collection(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Collection/841564295\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\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 CollectionMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n collection(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Collection/841564295\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\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 CollectionMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n collection(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"pinnedStatus\" => \"PINNED\",\n \"ownerId\" => \"gid://shopify/Collection/841564295\",\n \"first\" => 10,\n \"sortKey\" => \"PINNED_POSITION\",\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 CollectionMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n collection(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Collection/841564295\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CollectionMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n collection(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n}"
input: { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Collection/841564295", "first": 10, "sortKey": "PINNED_POSITION" }
response: { "data": { "collection": { "metafieldDefinitions": { "edges": [ { "node": { "name": "Target Audience", "namespace": "my_fields", "key": "target_audience", "type": { "name": "single_line_text_field" } } }, { "node": { "name": "Subtitle", "namespace": "my_fields", "key": "subtitle", "type": { "name": "single_line_text_field" } } } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CollectionShow($id: ID!) { collection(id: $id) { publishedOnCurrentPublication id title descriptionHtml updatedAt handle products(first: 10) { nodes { id } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Collection/841564295\"\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Collection/841564295\",\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n}"
input: { "id": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "publishedOnCurrentPublication": true, "id": "gid://shopify/Collection/841564295", "title": "IPods", "descriptionHtml": "<p>The best selling ipod ever</p>", "updatedAt": "2008-02-02T00:00:00Z", "handle": "ipods", "products": { "nodes": [ { "id": "gid://shopify/Product/632910392" } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query GetCollection($id: ID!) { collection(id: $id) { id title description handle image { url } products(first: 10) { nodes { id title } } updatedAt } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Collection/841564295\"\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Collection/841564295\",\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n}"
input: { "id": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "id": "gid://shopify/Collection/841564295", "title": "IPods", "description": "The best selling ipod ever", "handle": "ipods", "image": { "url": "https://cdn.shopify.com/s/files/1/0005/4838/0009/collections/ipod_nano_8gb.jpg?v=1733171181" }, "products": { "nodes": [ { "id": "gid://shopify/Product/632910392", "title": "IPod Nano - 8GB" } ] }, "updatedAt": "2008-02-02T00:00:00Z" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CollectionShow($id: ID!) { collection(id: $id) { publishedOnCurrentPublication id title descriptionHtml updatedAt handle image { id height width url } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n image {\n id\n height\n width\n url\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n image {\n id\n height\n width\n url\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Collection/841564295\"\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n image {\n id\n height\n width\n url\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Collection/841564295\",\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n image {\n id\n height\n width\n url\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n image {\n id\n height\n width\n url\n }\n }\n}"
input: { "id": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "publishedOnCurrentPublication": true, "id": "gid://shopify/Collection/841564295", "title": "IPods", "descriptionHtml": "<p>The best selling ipod ever</p>", "updatedAt": "2008-02-02T00:00:00Z", "handle": "ipods", "image": { "id": "gid://shopify/CollectionImage/867761954", "height": 456, "width": 123, "url": "https://cdn.shopify.com/s/files/1/0005/4838/0009/collections/ipod_nano_8gb.jpg?v=1733171181" } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query GetCollectionProductCount($collectionId: ID!) { collection(id: $collectionId) { productsCount { count precision } } }\",\n \"variables\": {\n \"collectionId\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GetCollectionProductCount($collectionId: ID!) {\n collection(id: $collectionId) {\n productsCount {\n count\n precision\n }\n }\n }`,\n \"variables\": {\n \"collectionId\": \"gid://shopify/Collection/841564295\"\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 GetCollectionProductCount($collectionId: ID!) {\n collection(id: $collectionId) {\n productsCount {\n count\n precision\n }\n }\n }\nQUERY\n\nvariables = {\n \"collectionId\": \"gid://shopify/Collection/841564295\"\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 GetCollectionProductCount($collectionId: ID!) {\n collection(id: $collectionId) {\n productsCount {\n count\n precision\n }\n }\n }\nQUERY;\n\n$variables = [\n \"collectionId\" => \"gid://shopify/Collection/841564295\",\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 GetCollectionProductCount($collectionId: ID!) {\n collection(id: $collectionId) {\n productsCount {\n count\n precision\n }\n }\n }`,\n {\n variables: {\n \"collectionId\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GetCollectionProductCount($collectionId: ID!) {\n collection(id: $collectionId) {\n productsCount {\n count\n precision\n }\n }\n}"
input: { "collectionId": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "productsCount": { "count": 1, "precision": "EXACT" } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query CollectionShow($id: ID!) { collection(id: $id) { publishedOnCurrentPublication id title descriptionHtml updatedAt handle products(first: 10) { nodes { id } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Collection/841564295\"\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Collection/841564295\",\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 CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CollectionShow($id: ID!) {\n collection(id: $id) {\n publishedOnCurrentPublication\n id\n title\n descriptionHtml\n updatedAt\n handle\n products(first: 10) {\n nodes {\n id\n }\n }\n }\n}"
input: { "id": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "publishedOnCurrentPublication": true, "id": "gid://shopify/Collection/841564295", "title": "IPods", "descriptionHtml": "<p>The best selling ipod ever</p>", "updatedAt": "2008-02-02T00:00:00Z", "handle": "ipods", "products": { "nodes": [ { "id": "gid://shopify/Product/632910392" } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query GetCollection($id: ID!) { collection(id: $id) { id title description handle image { url } products(first: 10) { nodes { id title } } updatedAt } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Collection/841564295\"\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Collection/841564295\",\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n}"
input: { "id": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "id": "gid://shopify/Collection/841564295", "title": "IPods", "description": "The best selling ipod ever", "handle": "ipods", "image": { "url": "https://cdn.shopify.com/s/files/1/0005/4838/0009/collections/ipod_nano_8gb.jpg?v=1733171181" }, "products": { "nodes": [ { "id": "gid://shopify/Product/632910392", "title": "IPod Nano - 8GB" } ] }, "updatedAt": "2008-02-02T00:00:00Z" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query GetCollection($id: ID!) { collection(id: $id) { id title description handle image { url } products(first: 10) { nodes { id title } } updatedAt } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Collection/841564295\"\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Collection/841564295\"\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Collection/841564295\",\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 GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Collection/841564295\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GetCollection($id: ID!) {\n collection(id: $id) {\n id\n title\n description\n handle\n image {\n url\n }\n products(first: 10) {\n nodes {\n id\n title\n }\n }\n updatedAt\n }\n}"
input: { "id": "gid://shopify/Collection/841564295" }
response: { "data": { "collection": { "id": "gid://shopify/Collection/841564295", "title": "IPods", "description": "The best selling ipod ever", "handle": "ipods", "image": { "url": "https://cdn.shopify.com/s/files/1/0005/4838/0009/collections/ipod_nano_8gb.jpg?v=1733171181" }, "products": { "nodes": [ { "id": "gid://shopify/Product/632910392", "title": "IPod Nano - 8GB" } ] }, "updatedAt": "2008-02-02T00:00:00Z" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { collection(id: \\\"gid://shopify/Collection/-1\\\") { id title } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n collection(id: \"gid://shopify/Collection/-1\") {\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 collection(id: \"gid://shopify/Collection/-1\") {\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\n query {\n collection(id: \"gid://shopify/Collection/-1\") {\n id\n title\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 collection(id: \"gid://shopify/Collection/-1\") {\n id\n title\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n collection(id: \"gid://shopify/Collection/-1\") {\n id\n title\n }\n}"
input: null
response: { "data": { "collection": null } }