Learn how to filter by, read, update, and clear the rating column on monday boards using the platform API
The rating column stores a numeric rating value that can be used to rank or score items.
Via the API, the rating column supports read, filter, update, and clear operations.
Column Type | Implementation Type | Supported Operations |
|---|---|---|
|
|
|
Queries
Rating columns can be queried through the column_values field on items queries using an inline fragment on RatingValue.
query {
items(ids: [1234567890, 9876543210]) {
column_values {
... on RatingValue {
rating
updated_at
}
}
}
}Fields
You can use the following fields to specify what information your RatingValue implementation will return.
| Field | Description |
|---|---|
column Column! | The column the value belongs to. |
id ID! | The column's unique identifier. |
rating Int | The rating value. |
text String | The column's value as text. Returns "" if the column has an empty value. |
type ColumnType! | The column's type. |
updated_at Date | The date the rating was last updated. |
value JSON | The column's JSON-formatted raw value. |
Filter
You can filter items by rating values using the items_page object. The rating column supports the following operators:
Operators | Compare Values |
|---|---|
|
|
|
|
Example
The following example returns all items whose rating column is not blank.
query {
boards(ids: 1234567890) {
items_page(
query_params: {
rules: [
{
column_id: "rating"
compare_value: [0]
operator: not_any_of
}
]
}
) {
items {
id
}
}
}
}Update
You can update a rating column using change_multiple_column_values by passing a JSON string in column_values.
To update a rating column, send a number between 1 and the column's rating scale. If you'd like to adjust the rating scale, you can do so in the column settings.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"rating\": {\"rating\": 5}}"
) {
id
}
}Clear
You can clear a rating column using change_multiple_column_values by passing null or an empty object in column_values.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 123456789
column_values: "{\"rating\": null}"
) {
id
}
}