Vote Queries
Votes are exposed through the votes field on a Post; the public API does not
have a top-level vote or votes query.
Get Votes for a Post
query GetPostVotes(
$postId: String!
$cursor: String
$limit: Int
) {
post(id: $postId) {
id
votes(cursor: $cursor, limit: $limit) {
nodes {
id
type
}
hasMore
cursor
}
}
}
Variables
{
"postId": "POST_ID",
"cursor": null,
"limit": 25
}
Arguments
| Field | Type | Description |
|---|---|---|
postId | String! | ID of the post whose votes you want to retrieve |
cursor | String | Cursor returned by the previous page |
limit | Int | Number of votes to return; the server limits this to 1โ50 and defaults to 25 |
Return Type
Post.votes returns VotesPayload or null.
| Field | Type | Description |
|---|---|---|
nodes | [Vote]! | Votes in the current page |
hasMore | Boolean! | Whether another page is available |
cursor | String | Cursor to use for the next page |
Each Vote has an id, a type (UP, DOWN, or CANCEL), its post, and
the voting user when that user is available.
Vote details are returned only when the board's Voters field is public. If that
field is private, nodes is empty. Include apikey, ssotype, and ssoid in
the request headers.