API - How to update the status of an Item

Hi

I’ve been looking over the GraphQL API for a while now and have been trying to find a way to update the status of an item.

Can anyone point me in the right direction on how to update column values please?

Thanks
Scott

Hey Scott!

Welcome to the community :slight_smile: Glad to have you.

Check out our quickstart guides on this other thread: Announcement: API tutorial for PHP, Python, and Javascript!

Thanks for the links, however these guides only seem to deal with fetching and creating of items and I can’t see any examples of performing updates.

1 Like

Hey @asherrwood, in the last step, you’ll see a mutation that creates an item and updates its column values.

You can use the “update_multiple_column_values” mutation with similar arguments to update a status column (without creating a new item). Hope that helps!

1 Like

Thanks, I will look into update_multiple_column_values

1 Like

The following query can also update status of an item.

mutation {
change_column_value(board_id: 548533948, item_id: 548533949, column_id: “status”, value: “{“label”: “Stuck”}”) {
id
}
}
More details here


This works for me, but it only clears the status, I cannot update it to an existing one.
mutation {
change_column_value (
item_id: 670696655,
board_id: 670696651,
column_id: “status61”,
value: “{“labels”:[“Done”]}”
) {
id
column_values {
id
value
title
}
}
}

So in this case it will just apply a null instead of “Done”.

1 Like

Hi there @paulpop :wave: Congrats on your first post in the ommunity :slight_smile:

just to clarify, the label that you are trying to add has to exist within the board and the text also has to be an exact match. If your board has a “done” status and you are sending “Done” as the label, the platform will not recognize it, and despite the query being correct all in all, it will change the status to a null value instead. Does that make sense?

-Alex

-Alex

1 Like

Yes that makes sense.

Is there something I’m missing though because the label is shows here as “Done” (unless it has another label behind the scenes) image

I also examine and it seems there seems to be a different structure here when reading the column statuses.

"settings_str": "{\"labels\":{\"0\":\"Working on it\",\"1\":\"Done\",\"2\":\"Stuck\",\"14\":\"\",\"12\":\"\",\"7\":\"\"}}"

Also tried updating it with the indexes, it just makes any value null as well
value: "{\"ids\":[\"2\"]}"

Hey @paulpop ,
the mutation for the value of a status column looks like this:

mutation {

          change_column_value (

                board_id: "YOUR_BOARD_ID",
                item_id: "YOUR_ITEM_ID",
                column_id: "YOUR_STATUS_COLUMN_ID",
                value: {\"index\": 1}) {

                       id

          }

    }

Just insert any index instead of the “1”.
Note that doing it this way, the indexes have to exist already.
You can read more about that in the documentation under column-values-section-status

Greetings

To use labels in updating the status, the syntax is:

.... value: "{\"label\":\"Done\"}"....
3 Likes

Thanks, I tried this as well, executed it but do not see the actual update? Updating through the index seemed to work though.

Screenshot of executing update with label.

Edit: I ran this again and it seemed to work now.

Hmm just tried and it works ha. Thanks everyone

1 Like

Do you know if these indexes are set in stone for each label? Is there a way to view the indexes through the interface or would we have to query them through settings_str?

1 Like

@paulpop that’s a great question! You can find all of our indexes by color in this board view:

https://view.monday.com/471878000-13f8e67ced7f0463687b9694f8044fac

@TMNXT-Dev and @JCorrell - thanks for helping out in the thread guys, you’re awesome! :slight_smile:

The indexes are always the same for each color, so you could use that as a reference sheet :slight_smile:

-Alex

Hey @AlexSavchuk ,

this is a really helpfull boardview, do you have more of this kind ? So we could refer to?

1 Like

@TMNXT-Dev

Thanks for the feedback and I definitely agree! I am not aware of other board views that I can share right off the bat, but I’d definitely love to hear if you have any suggestions for us when it comes to making those board views - your feedback would help us make those happen :slight_smile:

-Alex