Skip to main content

Seeking Help for the API using the items_page object to filter MORE THAN 100 items

  • July 24, 2023
  • 6 replies
  • 1132 views

JiaTang
Forum|alt.badge.img

Hi All,

I’m using monday API documentation, Items Page to filter results the data from specific date range.

But I found the maximum number of items to return is 100.

I would like the query can return more than 100 items with filtering function.

Could anyone suggest it?

Thanks very much in advance:)

Best Regards,
Jia Tang

6 replies

dvdsmpsn
Forum|alt.badge.img+1
  • Participating Frequently
  • July 24, 2023

The docs say…

query {
  boards (ids: 1234567890){
    items_page (limit: 1, query_params: {rules: [{column_id: "status", compare_value: [1]}], operator: and}) {
      cursor
      items {
        id 
        name 
      }
    }
  }
}

Note the cursor :

An opaque token representing the position in a set of results to fetch items from. Use this to paginate through large result sets. Please note that you can’t use query_params and cursor in the same request. We recommend using query_params for the initial request and cursor for paginated requests.

Set the limit to 100 , execute the query, then to get the next 100, use the value of cursor given in the previous result set. Rinse & repeat until you have all the data needed.

You’ll need to pass the cursor in on each subsequent call to the API.


JiaTang
Forum|alt.badge.img
  • Author
  • New Participant
  • July 25, 2023

Hi @dvdsmpsn ,

Thank you very much!
I did test that use the value of cursor, it’s working properly! 😃


JiaTang
Forum|alt.badge.img
  • Author
  • New Participant
  • July 26, 2023

Hi @dvdsmpsn,

This is Jia again 😃!
Sorry for asking another question. It’s appreciated if you could help this.

For my next step, I’m using the query including cursor to get more column’s data not only for ‘id’ and ‘name’. I’ve tried 2 version of code below, but it all gave me the errors.

Could you please advise it?

Version 1:
query = ‘’'query {
boards (ids: ******) {
items_page (limit: 100, %s) {
cursor
items {
id
name
text
text1
date
hour
hour_1
status
}
}
}

Version 2:
query = ‘’‘query {
boards (ids: ******) {
items_page (limit: 100, %s) {
cursor
items {
id
name
column_values {
text
text1
date
hour
hour_1
status
}
}
}
}
}’‘’

Looking forward to your reply.
Thank you very much!


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • July 30, 2023

Hello there,

It looks like you are trying to get the column values for your items.

If that is the case, you can use a query like this one:

{
  boards(ids: 1234567890) {
    items_page(limit: 100) {
      cursor
      items {
        id
        name
        column_values{
          value
          text
        }
      }
    }
  }
}

Is this the information you needed?

Cheers,
Matias


JiaTang
Forum|alt.badge.img
  • Author
  • New Participant
  • August 3, 2023

Hi @Matias.Monday ,

Thanks very much!

Just a follow-up question, how can I get item id from board filter by an item name and a date column?

Looking forward to your reply:)


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • August 6, 2023

Hello again @JiaTang,

If you want to get the item’s ID and you only have the item’s name and date, you can use a query like this one:

{
  items_by_column_values(
    board_id: 1234567890
    column_id: "name"
    column_value: "Item 1"
  ) {
    id
    name
  }
}

If you need BOTH the name and date to be taken into account, you will need to then send a second query using the desired date:

{
  items_by_column_values(
    board_id: 1234567890
    column_id: "date"
    column_value: "2019-02-06"
  ) {
    id
    name
  }
}

You would then check for the ID that is present in both results.

Let me know if you have any other questions!

Cheers,
Matias