The error youâre seeing when you run your GraphQL query is due to the fact that the collections query requires you to specify either the first or last argument, which determines the number of collections to retrieve.
To avoid this error, you can simply add either the first or last argument to your query, and specify the number of collections you want to retrieve. For example, you can use the following query to retrieve the first 10 collections that match your query:
query {
collections(query: "metafields.custom.is_vendor:true", first: 10) {
edges {
node {
id
title
}
}
}
}
Alternatively, you can use the pageInfo field in the query response to paginate the results and retrieve more than 10 collections. This can be useful if you have more than 10 collections that match your query, and you want to retrieve them all in multiple requests.
Here is an example of how you might use the pageInfo field to paginate the results and retrieve all of the matching collections:
query {
collections(query: "metafields.custom.is_vendor:true", first: 10) {
edges {
node {
id
title
}
}
pageInfo {
hasNextPage
hasPreviousPage
}
}
}
In this example, the pageInfo field in the query response will contain two fields: hasNextPage and hasPreviousPage. These fields will be set to true if there are more collections to retrieve, and false if there are no more collections to retrieve.
You can use these fields to determine whether to make additional requests to retrieve the remaining collections. For example, you can use the after argument in the collections query to specify the cursor position of the last collection in the previous response, and retrieve the next 10 collections that match your query.
Here is an example of how you might use the after argument to retrieve the next 10 collections that match your query:
query {
collections(query: "metafields.custom.is_vendor:true", first: 10, after: "YXJyYXljb25uZWN0aW9uOjk=") {
edges {
node {
id
title
}
}
pageInfo {
hasNextPage
hasPreviousPage
}
}
}
In this example, the after argument specifies the cursor position of the last collection in the previous response, which allows the query to retrieve the next 10 collections that match your query.
Hope it helps