Vote
The vote column allows board subscribers and team members to vote for items. Our API partially supports the vote column, so you can filter and read it, but you can't update or clear it via the API.
Filtering the vote 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 vote column's supported operators and compare values.
Operators | Compare values |
---|---|
any_of | "No votes" |
not_any_of | "No votes" |
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 where user 123456 voted in the vote column.
query {
boards (ids: 1234567890) {
items_page (query_params: {rules: [{column_id: "vote", compare_value: [123456], operator:any_of}]}) {
items {
id
name
}
}
}
}
Reading the vote column
You can query the vote 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 vote column are of the VoteValue
type.
Pro tip
column_values
v2 fields are only available in API version2023-10
.
query {
items (ids:[1234567890, 9876543210]) {
column_values {
... on VoteValue {
vote_count
voter_ids
}
}
}
}
Fields
Field | Description |
---|---|
column Column! | The column the value belongs to. |
id ID! | The column's unique identifier. |
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. |
vote_count Int! | The total number of votes. |
voter_ids [ID!]! | The unique identifiers of users who voted. |
Column values v1
You can return the data in a vote column in two different formats when you query by column values. The text
field will return the total number of votes for an item 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": "1",
"value": "{\"votersIds\":[31855020],\"changed_at\":\"2022-08-05T12:00:00.000Z\"}"
}
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