Anchor to nodes
nodes
query
Returns the list of nodes (any objects that implement the Node interface) with the given IDs, in accordance with the Relay specification.
Anchor to Arguments
Arguments
- •[ID!]!required
The IDs of the Nodes to return.
Was this section helpful?
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 list of objects using a nodes query
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
nodes(ids: ["gid://shopify/Product/108828309", "gid://shopify/GiftCard/924862292", "gid://shopify/Collection/142458073"]) {
id
... on Product {
title
}
... on GiftCard {
balance {
amount
currencyCode
}
}
... on Collection {
sortOrder
}
}
}`,
);
const data = await response.json();
query {
nodes(ids: ["gid://shopify/Product/108828309", "gid://shopify/GiftCard/924862292", "gid://shopify/Collection/142458073"]) {
id
... on Product {
title
}
... on GiftCard {
balance {
amount
currencyCode
}
}
... on Collection {
sortOrder
}
}
}
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 { nodes(ids: [\"gid://shopify/Product/108828309\", \"gid://shopify/GiftCard/924862292\", \"gid://shopify/Collection/142458073\"]) { id ... on Product { title } ... on GiftCard { balance { amount currencyCode } } ... on Collection { sortOrder } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
nodes(ids: ["gid://shopify/Product/108828309", "gid://shopify/GiftCard/924862292", "gid://shopify/Collection/142458073"]) {
id
... on Product {
title
}
... on GiftCard {
balance {
amount
currencyCode
}
}
... on Collection {
sortOrder
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
nodes(ids: ["gid://shopify/Product/108828309", "gid://shopify/GiftCard/924862292", "gid://shopify/Collection/142458073"]) {
id
... on Product {
title
}
... on GiftCard {
balance {
amount
currencyCode
}
}
... on Collection {
sortOrder
}
}
}`,
});
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 {
nodes(ids: ["gid://shopify/Product/108828309", "gid://shopify/GiftCard/924862292", "gid://shopify/Collection/142458073"]) {
id
... on Product {
title
}
... on GiftCard {
balance {
amount
currencyCode
}
}
... on Collection {
sortOrder
}
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"nodes": [
{
"id": "gid://shopify/Product/108828309",
"title": "Draft"
},
{
"id": "gid://shopify/GiftCard/924862292",
"balance": {
"amount": "75.0",
"currencyCode": "USD"
}
},
{
"id": "gid://shopify/Collection/142458073",
"sortOrder": "MANUAL"
}
]
}