Hour
The hour column contains a specific time entry for an item in HH:MM format. Our API fully supports the hour column, so you can filter, read, update, and clear it via the API.
Filtering the hour column
Using the items_page
object, you can easily filter a board's items by specific columns or column values. The table below contains the hour column's supported operators and compare values.
Operators | Compare values |
---|---|
any_of | "Early morning" "Morning" "Afternoon" "Evening" "Night" |
not_any_of | "Early morning" "Morning" "Afternoon" "Evening" "Night" |
is_empty | null |
is_not_empty | null |
Pro tip
items_page
is only available in API version2023-10
for now.
The following example returns all items on the specified board with an hour column value in the afternoon.
query {
boards (ids: 1234567890) {
items_page (query_params: {rules: [{column_id: "hour", compare_value: ["Afternoon"], operator:any_of}]}) {
items {
id
name
}
}
}
}
Reading the hour column
You can query the hour column using the column_values
object. The object has different fields based on which API version you are using. Column values v2 fields will be available in API versions 2023-10
and later, while column values v1 fields are only supported in versions 2023-07
and 2023-04
.
Column values v2
The column_values
object enables you to return column-specific subfields by sending a fragment in your query. Values for the hour column are of the HourValue
type.
Pro tip
column_values
v2 fields are only available in API version2023-10
.
query {
items (ids:[1234567890, 9876543210]) {
column_values {
... on HourValue {
minute
hour
}
}
}
}
Fields
Field | Description |
---|---|
column Column! | The column the value belongs to. |
hour Int | The column's hour value. |
id ID! | The column's unique identifier. |
minute Int | The column's minute value. |
text String | The column's value as text. |
type ColumnType! | The column's type. |
updated_at Date | The column's last updated date. |
value JSON | The column's JSON-formatted raw value. |
Column values v1
You can return the data in an hour column in two different formats when you query by column values. The text
field will return the time as a simple string. The value
field will return metadata about the column as a JSON string.
Removing column values v1 support
column_values
v1 fields will no longer be supported in API versions2023-10
and later.
{
"text": "08:00 AM",
"value": "{\"hour\":8,\"minute\":0,\"changed_at\":\"2022-07-21T12:00:00.000Z\"}"
}
Updating the hour column
You can update an hour column using the change_multiple_column_values
mutation and passing a JSON string in the column_values
argument. Simple string updates are not supported.
JSON
To update an hour column, send the hour and minute in 24-hour format. Make sure you remove any leading zeroes from the data you send (i.e., send the number 9 instead of 09). Check out this mutation in action in our Postman library or follow along with these code samples!
mutation {
change_multiple_column_values(item_id:9876543210, board_id:1234567890, 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: 1234567890,
myItemId: 9876543210,
myColumnValues: "{\"hour\" : {\"hour\" : 16, \"minute\": 42}}"
})
})
})
Clearing the hour column
You can also clear an hour column using the change_multiple_column_values
mutation and passing null
or an empty object in the column_values
argument.
mutation {
change_multiple_column_values(item_id:9876543210, board_id:1234567890, column_values: "{\"hour\" : null}") {
id
}
}
fetch ("https://api.monday.com/v2", {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization' : 'YOUR_API_KEY_HERE'
},
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: 1234567890,
myItemId: 9876543210,
myColumnValues: "{\"hour\" : null}"
})
})
})
Join our developer community!
We've created a community specifically for our devs where you can search through previous topics to find solutions, ask new questions, hear about new features and updates, and learn tips and tricks from other devs. Come join in on the fun! 😎
Updated 3 months ago