A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello,
I have hundreds of fulfillmentOrder ids and I have to query some data as:
{ nodes(ids: [${ids.splice(0, 250).map((id) => `"${id}"`)}]) { ... on FulfillmentOrder { id, lineItems(first:150) { nodes { id, remainingQuantity, totalQuantity, sku } } fulfillments(first:10) { nodes { id trackingInfo { number } fulfillmentLineItems(first:150) { nodes{ quantity, lineItem { sku } } } } } } } }
The problem is that this costs too much of query cost, can't query more than 1 000 query cost (first of all I don't understand this limit as I have 10 000 available),
I tried it by a bulk query but it returns errors:
Queries that contain a connection field within a list field are not currently supported
Bulk queries cannot contain more than 5 connections
I also tried it with aliases, it didn't work neither.
Is there a way to make this query work or do I really have to make multiple query for every ids?
Thanks in advance.
Solved! Go to the solution
This is an accepted solution.
I did some changes and it works for the moment, instead of re-querying for fulfillmentOrders I take fulfillments ids and query nodes on Fulfillment
like this
{
nodes(ids: [${splicedIds.map((id) => `"${id}"`)}]) {
... on FulfillmentOrder {
id,
lineItems(first:150) {
nodes {
id, remainingQuantity, totalQuantity, sku
}
}
fulfillments(first:15) {
nodes {
id
}
}
}
}
}
in js I just take the fulfillment ids with
ffOrders.map((ffOrder) => ffOrder.fulfillments.nodes.map((f) => f.id)).flat();
and then I query for Fulfillment
{
nodes(ids: [${ffIds.splice(0, 250).map((id) => `"${id}"`)}]) {
... on Fulfillment {
id
trackingInfo {
number
}
fulfillmentLineItems(first:150) {
nodes{
quantity,
lineItem {
sku
}
}
}
}
}
}
I post it if someone, noob on graphql like me, needs
Hello,
I tried to make 2 queries as
{
nodes(ids: [${splicedIds.map((id) => `"${id}"`)}]) {
... on FulfillmentOrder {
id,
lineItems(first:150) {
nodes {
id, remainingQuantity, totalQuantity, sku
}
}
fulfillments(first:15) {
nodes {
id
trackingInfo {
number
}
}
}
}
}
}
and
{
nodes(ids: [${splicedIds.map((id) => `"${id}"`)}]) {
... on FulfillmentOrder {
fulfillments(first:15) {
nodes {
id
fulfillmentLineItems(first:150) {
nodes{
quantity,
lineItem {
sku
}
}
}
}
}
}
}
}
The first one is ok but the other has MAX_COST_EXCEEDED problem, can someone help on this pls?
This is an accepted solution.
I did some changes and it works for the moment, instead of re-querying for fulfillmentOrders I take fulfillments ids and query nodes on Fulfillment
like this
{
nodes(ids: [${splicedIds.map((id) => `"${id}"`)}]) {
... on FulfillmentOrder {
id,
lineItems(first:150) {
nodes {
id, remainingQuantity, totalQuantity, sku
}
}
fulfillments(first:15) {
nodes {
id
}
}
}
}
}
in js I just take the fulfillment ids with
ffOrders.map((ffOrder) => ffOrder.fulfillments.nodes.map((f) => f.id)).flat();
and then I query for Fulfillment
{
nodes(ids: [${ffIds.splice(0, 250).map((id) => `"${id}"`)}]) {
... on Fulfillment {
id
trackingInfo {
number
}
fulfillmentLineItems(first:150) {
nodes{
quantity,
lineItem {
sku
}
}
}
}
}
}
I post it if someone, noob on graphql like me, needs