Lost in new API. Help constructing a query

Can someone assist in converting this query to the new API using items_page? I need to pull the information for roughly 6000 subitems. As a noob, I was just wrapping my head around GraphQL with the last API version but now I am just lost. Any help is appreciated:
{
“query”: “query {items(ids: [XXX,XXX,XXX,XXX,XXX]) {id column_values{value text}}}”
}

Can this type of query be done at the item/subitem board ID level or do I need to feed each item ID into the query?

Hello,

To confirm, if you do know the specific item IDs, you can still use the items query in this way. Per the documentation on items linked here, you can still query with items at the root to retrieve specific items. If this query is already working for you, I would suggest keep it!

Best,
Joseph

Hi Joseph,

The 100 item limitation is a challenge when attempting to query 6000 +/- items. I’m looking for a query which will allow me to retrieve all the required information in a single query or at least significantly fewer than 60+ queries. Will items_page allow for an increase in the limit?

Are all the items you’re retrieving from the same board? Thats required for items_page. items_page is the paginator of a boards items (and a filter/sorter too) so you can retrieve 500 items at a time (there are limitations, large items with many columns take longer to retrieve and you could timeout the request).

You can also use the 500 to quickly fetch all the item Ids then use some technique to parallelize getting the items in batches of 100. You’re making more calls but doing them at the same time so there may in fact be a performance increase.

Yes. All items are on the same board. How would I construct an items_page query to pull 500 at a time and filter to include records where any one of three columns (numbers1, numbers2 and numbers3) is > 0 and return {id column_values{text}} for the matching records?

Hello there @mcdemon,

What about something like this:

{
  boards(ids: 1111111) {
    items_page(
      limit: 500
      query_params: {rules: [{column_id: "numbers", compare_value: [0], operator: greater_than}, {column_id: "numbers_1", compare_value: [0], operator: greater_than}, {column_id: "numbers_2", compare_value: [0], operator: greater_than}], operator: or}
    ) {
      cursor
      items {
        id
        column_values {
          text
        }
      }
    }
  }
}

You can then use the cursor to paginate as explained here :grin:

Let me know what you think!

Cheers,
Matias

1 Like