Query and Updating Subitems

hey,
I created a board with a group of items and subitems.
this board is supposed to get updated from other source so I created an automation for that using your API.
is there a way to query a subitem (including its columns values) by its ID (as I can do with items)?
is there a way to update subitem columns values (as change_multiple_column_values item API)?
thanks

Hello @Avisw and welcome to the community!

I hope you like it here :muscle:

You can query subitems in the same way as items.

For example, this query would work when passing a subitem’s ID:

{
  items(ids: 1234567890) {
    name
    column_values {
      value
      text
    }
  }
}

And the same goes for updating subitems. A query like this one would work (you have to use the subitem’s board ID):

mutation {
  change_multiple_column_values(board_id: 5544332211, item_id: 9876543211, column_values: "{\"status\": \"Done\", \"text\":\"My text\"}") {
    id
  }
}

I hope that helps :slightly_smiling_face:

Cheers,
Matias

hey @Matias.Monday ,
thanks for the quick response.
I got 2 more questions regarding that:

  1. is it possible to move an item between group by API?
  2. is it possible to convert an item to a subitem by API?

thanks

Hello again,

  1. Yes. It is possible. You can check how to do it here.

  2. To do that you would need to query for the item using the API, and then create the subitem with the values you got in the first query with create_subitem.

Cheers,
Matias

1 Like

is the board id the items board id or the sub item board id?

Hello there,

If you are trying to query or mutate an item, then the main board ID. If you are trying to query or mutate a subitem, then the board ID of the subitems board.

Cheers,
Matias