MDC API - Options to update an existing item

Hello,

I’d like to know what are the possible options to update an existing item in MDC. From API documentation I found one way to do it:

mutation {
    change_simple_column_value (board_id: 20178755, item_id: 200819371, column_id: "status", value: "1") {
        id
    }
}

Several questions:

  • Are there other API options to make an update?

  • In the above mutation why should we provide both item_id and borad_id? (board_id can be inferred from item_id…) In our system, we want to store just item_ids in the database. So to update an item we need first to query for item’s board_id, and then call the above mutation. This is two web requests per update.

  • Is there an option to make a single or bulk update based on custom column value? For example,

mutation {
    update_items(board_id: 20178755, column_id_to_look: "col1", column_value_to_look: "hello", column_id_to_update: “col2” column_value_to_update: "world") {
        id
    }
}

Which will update “col2” with value “world” for all items where “col1” has the value “hello”, in the mentioned board_id.

In our system, we already store custom ids to link between MDC items and DB items, so update by custom column is helpful here. And we also need to update several items in MDC per one item in our DB - would like to do it in one web request.

Thanks,
Marat

Hello @marat.z and welcome to the community!

I hope you like it here :muscle:

You can update the column values of your items using change_simple_column_value, change_multiple_column_values and change_column_value as explained here.

The board ID is necessary as of today because of the way the method is built.

You can use items_by_column_value as explained here and then use the IDs of the items to update them. You can’t do it in a single request.

Let me know if you have any other questions :slightly_smiling_face:

Cheers,
Matias

Hi @Matias.Monday,

Thanks for the reply, the options are clear now.

Similarly to change_multiple_column_values it would be great to provide a transpose method change_multiple_**rows**_values, which will accept list of item_ids, column_id and value to update. If we want to update a column with same value for N items we need to mutate N times, doing it in 1 mutation would be more stable and performant.

Talking about items_by_column_value, we need to provide board_id. Just wanted to confirm if there is (or not) an API to get items by column values without providing specific board_id - so it searches through list of relevant boards?

Thanks,
Marat