Updating subitems via API

I’m attempting to use the API to update the status of a subitem, but I’m not having any luck.

  • Is it possible to do this through the API?
  • If not, is my workaround below the best way possible currently?

I’ve seen the discussion here that indicates that perhaps this wasn’t possible last year, but we’re a good few months on from that so it might have changed.

I’ve also tried to update an subitem’s status, as I would for an item, but with the board_id as the parent item’s id and the item_id as the sub item id. I was not successful with this.

My current thinking of a work around is horrible, but as follows:

  • Query the board to get all of the fields of the subitems.
  • Delete the subitem.
  • Create a new subitem with all of the same data, but an updated status.

Thank you for any help and input!

Hi @SirOnion!

Great question-- you can absolutely change a subitem’s status column.

You would first need to query the parent board items, then these item’s column values to find the board ID of the subitems (since subitems have their own board Id). You can then utilize this board Id to change the subitem’s status columns.

Try this out and let me know if you run into any trouble!

-Helen

Thanks Helen, I have it working now, but in a bit of a strange way. It’s working fine, but there may be a better way to do things. Either way, I thought I’d write it up for others.

Starting with the item_id of a subitem, first query to find the board that the subitem is part of:

query {items (ids: [1234]) {
    board { id }
  }
}

You get a response like this:

{ 
  "data": {"items": [{"board": {"id": "2345"}}]},
  "account_id": 1111
}

This board id can then be fed into a modify query:

 mutation{
  change_column_value(
    board_id: 2345,
    item_id: 1234,
    column_id: "status",
    value: "{\"label\": \"Some new status!\"}") {
  id
  }
}

I’m not sure why you need to find out the board ID when the subitem’s item_id is unique, I’m also not sure whether it’s possible to nest graphql queries so you can use the result of the first as part of the second in one API request. On the other hand, I guess it’s pretty rare to start with a subitem’s item_id and not know which board it’s from. shrug

1 Like

This is perfect! The exact same steps I would take if I wanted to mutate subitem column data as well.

Yes-- the fact that you need to query the board Id is a bit unorthodox. This is something that our developers are aware of and are currently hoping to implement/fix.

Thank you for sharing! I’m sure many of our users will find this helpful.