Anchor to node
node
query
Returns a specific node (any object that implements the Node interface) by ID, in accordance with the Relay specification. This field is commonly used for refetching an object.
Anchor to Possible returnsPossible returns
- Anchor to NodeNode•
An object with an ID field to support global identification, in accordance with the Relay specification. This interface is used by the node and nodes queries.
Was this section helpful?
Retrieve a product using a node query
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
node(id: "gid://shopify/Product/108828309") {
id
... on Product {
title
handle
}
}
}`,
);
const data = await response.json();
query {
node(id: "gid://shopify/Product/108828309") {
id
... on Product {
title
handle
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { node(id: \"gid://shopify/Product/108828309\") { id ... on Product { title handle } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
node(id: "gid://shopify/Product/108828309") {
id
... on Product {
title
handle
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
node(id: "gid://shopify/Product/108828309") {
id
... on Product {
title
handle
}
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
node(id: "gid://shopify/Product/108828309") {
id
... on Product {
title
handle
}
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"node": {
"id": "gid://shopify/Product/108828309",
"title": "Draft",
"handle": "draft"
}
}