How to Extract All Items from Board using Latest API Version

Hello All,

I currently have the below GraphQL query, which extracts all items in a board. It works for API version 2023-07, but that one is being deprecated. Note the board number in the example below is not a real board.

query {
  boards(ids: 123456789) {
    items(limit: 20, page: 1) {
      name
      column_values {
        title
        text
      }
    }
  }
}

I am wondering if there is an equivalent GraphQL query that will pull all items from the board using the latest API version.

On another note, wondering if the new query could have the data structured a little differently.

The existing query returns the data like this:

{
  "data": {
    "boards": [
      {
        "items": [
          {
            "name": "Client_One",
            "column_values": [
              {
                "title": "Board_Column_1",
                "text": "10 Hours"
              },
              {
                "title": "Board_Column_2",
                "text": "Jon Doe"
              },
              {
                "title": "Board_Column_3",
                "text": "Sarah Jane"
              }
etc...

Wondering if it’s possible to structure the JSON so that the column_text under each column title has its own brackets. Basically the column_text would get nested under each respective column title. The reasoning is if the column order gets changed, we can still refer to the column title rather than the order of the columns.

something like the below (although it’s not properly formattted)

{
  "data": {
    "boards": [
      {
        "items": [
          {
            "name": "Client_One",
            "column_values": [
              {
                "title": "Board_Column_1",
                           ["column_text": "10 Hours"]
              },
              {
                "title": "Board_Column_2",
                	["column_text": "Jon Doe"]
              },
              {
                "title": "Board_Column_3",
                	["column_text": "Sarah Jane"]
              }

Thanks,
Chris

Hello there @christopher.matthews and welcome to the community!

I hope you like it here :muscle:

You can get the items of your board using version 2023-10 by utilizing items_page as explained here.

I think the closest you can get to that output would be using something like this:

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

I hope that helps!

Cheers,
Matias

1 Like

@Matias.Monday Does it return archived items also?

Hello @sl1nna,

No. Archived items will not be returned.

I have added your vote for a request we have for that :grin:

Cheers,
Matias

2 Likes