Unable to update week column with API

I am trying to update a week column with the api, however, I am running into an issue.
Whenever I try to add a value to the week column for a given item, the API returns successfully, however, the week fails to update on my board. This happens no matter what I am using (python or the graphql explorer) and even when I try to run the example provided in the documentation here, replacing the boardid and itemid with my values.

I have also noticed that when I fill the value in monday normally and then try to update it with the api, the value gets wiped from the item.

Not sure what is going on here, any and all help will be apricated.

hi @anthony.lombardi

Welcome to the community! What I always do when it doesn’t seem to update is:

  1. create a new board with the column type you need (in the case a week column)
  2. update the column in the UI
  3. use API playground to read the item / value, with:
{
  items(ids: 123456789) {
    column_values(ids: "week") {
      value
    }
  }
}
  1. copy/paste the returned value, in my case:
"value": "{\"week\":{\"endDate\":\"2022-07-24\",\"startDate\":\"2022-07-18\"}}"
  1. use API playground to do update (in this case with modified start and end dates)
mutation {
  change_column_value(board_id: 123456789, item_id: 123456789, column_id: "week", value: "{\"week\":{\"endDate\":\"2022-07-17\",\"startDate\":\"2022-07-11\"}}") {
    id
  }
}
  1. run it and check the result in the board. I am sure your week will be updated

In many case people have the value wrong (with the escape characters etc) and using this method you will quickly learn what value is expected (in which format) for that column.

@basdebruin Thanks for the response!
I have got the change_column_value mutation working in both the playground and my python script
However, I have now found out that the issue lies with the change_multiple_column_values mutation
In the playground I ran this snippet:

mutation {
  change_multiple_column_values(item_id: XXXXXX, board_id: XXXXXXX, column_values: "{\"week\":{\"endDate\":\"2022-07-24\",\"startDate\":\"2022-07-18\"}}") {
    id
  }
}

And I got this response:

{
  "data": {
    "change_multiple_column_values": {
      "id": "XXXXXXXXX"
    }
  },
  "account_id": XXXXXX
}

However, the week column remains not updated for this item, and when I fill in the value with the UI and then run this mutation the value gets removed from the item.

hi @anthony.lombardi

If you want to use change_multiple_values you have to sepecify the column/value pairs (“columnId”:“value”). As this column type requires an object in the form:

"{\"week\":{\"endDate\":\"2022-07-17\",\"startDate\":\"2022-07-11\"}}"

and the columnId is probably “week” also, your full mutation will look a little weird as the string “week” is 2 times present (1st is the columnid and 2nd is part of the object)

This one should do it

mutation {
  change_multiple_column_values(board_id: 123456789, item_id: 987654321, column_values: "{\"week\":{\"week\":{\"endDate\":\"2022-07-17\",\"startDate\":\"2022-07-11\"}}}") {
    id
  }
}

This one works perfectly fine for me.

@basdebruin Yes that was it! Thank you for your help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.