The hour column contains a time entry in HH:MM time. Our API supports this column, so you can read and update the hour column via the API.

Reading the hour column

You can return the data in an hour column in two different formats. The text field will return the data as a simple string, and the value field will return the data as a JSON string.

{
  "text": "08:00 AM",
  "value": "{\"hour\":8,\"minute\":0,\"changed_at\":\"2022-07-21T12:00:00.000Z\"}"
}

Updating the hour column

JSON

You can update an hour column with a JSON string. Simple string updates are not supported.

To update an hour column, send the hour and minute in 24-hour format. For example: "{\"hour\":16,\"minute\":42}"

Make sure you remove any leading zeroes from the data you send (ie, send the number 9 instead of 09). Like this: "{\"hour\":13,\"minute\":0}"

mutation {
  change_multiple_column_values(item_id:11111, board_id:22222, column_values: "{\"hour\" : {\"hour\" : 16, \"minute\" : 42}}") {
    id
  }
}
fetch ("https://api.monday.com/v2", {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }",
    variables : JSON.stringify({
      myBoardId: YOUR_BOARD_ID,
      myItemId: YOUR_ITEM_ID,
      myColumnValues: "{\"hour\" : {\"hour\" : 16, \"minute\": 42}}"
    })
  })
})

You can find the Postman request to change the hour column here.

Clearing the hour column

You can clear the hour column using a change_multiple_column_values mutation.

mutation {
  change_multiple_column_values(item_id: 2973227073, board_id: 2973227049, column_values: "{\"hour\" : {}}") {
    id
  }
}

πŸ“˜

Have questions?

Join our developer community! You can share your questions and learn from fellow users and monday.com product experts.

Don’t forget to search before opening a new topic!