Api v2 - get item data with fourmula and linked cell board/itemid

Hey,
im trying to create a query where i can get the item coulms_values.
i have the item id and board it, and i would like to get the columnes value. and if one of the cell are linked to other board , i would like to get the item id in the other board is it possible?
i think it called : linkedPulseId?

        query = f"""
  query {{
  items (ids:[{item_id}]) {{
    id
    name
    column_values {{
		text
      id
      value
      type
    }}
  }}
}}

i tired this, but its only giving me the value , and i dont see the linked cell name and item id.

i used to use but its not working any more.

        query = f"""
  query {{
    boards(ids: [{board_id}]) {{
      items(ids: [{item_id}]) {{
        id
        name
        column_values {{
          title
          text
        }}
      }}
    }}
  }}
"""

Welcome to the Developer Community!

You’ve got two things going on here, first with API 2023-10 and later, the items query on boards and groups is no longer directly available, and must be nested in items_page which it the pagination controller. See items_page for more details.

Next you need to look into column values v2 which allows you to use GraphQL fragments to return detailed column value information that depends on the column type.

In this case you’re looking at a connect boards column.

Since it sounds like you just need for one item, we don’t need the boards query, it just slows things down and adds API complexity.

query ($itemIds: [ID!], $columnIds: [String!]) {
  items(ids: $itemIds) {
    id
    column_values(ids: $columnIds) {
      id
      ... on BoardRelationValue {
        linked_item_ids
        linked_items {
          id
          name
          column_values {
            id
            value
          }
        }
      }
    }
  }
}

note, I used GraphQL variables, rather than f-strings because then you don’t have to worry about escaping quotes and formatting things just right. Simple string, and you pass your variable values alongside it. The specifics are out of scope for this message.

I’ve included both linked_item_ids and linked_items in the query, the first just returns an array of item IDs. The second one actually lets you access the items directly, including their column values, but that may not be the most efficient way since it will consume extra API complexity points so rate limit you sooner. Sometimes splitting queries is faster in overall to avoid API rate limits.

2 Likes

it didnt work for me,
all i need is to pull item data and the connected board for given item. and i also have board id if it helps.

with the connected board item id, i then will need to pull the data of this item to.

is there a way of doing it easy and optmized? i dont care if i send 2-3 api requests to get what i need. but i do want it to be efficent to not exeeced the rate limit.

@anon29275264 Thank you!

I am unsure what you are needing.

I thought you wanted the item IDs that the item is connected to on a particular connect boards column. Do you just want the board ID that its connected to and not the items it is connected to?