Votes
Represents the positive and negative votes cast by users on articles, article comments, posts, and post comments.
Table-Specific Information
Select
The following queries are processed server-side while other filters are processed client-side within the provider.SELECT * FROM Votes WHERE UserId = '19128124956177'
SELECT * FROM Votes WHERE ArticleId = '19206579478289'
SELECT * FROM Votes WHERE Locale = 'en-us' AND ArticleId = '19206579478289'
SELECT * FROM Votes WHERE ArticleId = '19206579478289' AND CommentId = '19244072685969'
SELECT * FROM Votes WHERE Locale = 'en-us' AND ArticleId = '19206579478289' AND CommentId = '19244072685969'
SELECT * FROM Votes WHERE PostId = '19206579516945'
SELECT * FROM Votes WHERE PostId = '19206579516945' AND CommentId = '19244379733521'
Insert
The Value column is required to insert.
To create a vote for a given article:
INSERT INTO Votes (ArticleId, Value) VALUES ('19206579478289', 1)
To create a vote for a given article comment:
INSERT INTO Votes (ArticleId, CommentId, Value) VALUES ('19206579478289', '19244072685969', 1)
To create a vote for a given post:
INSERT INTO Votes (PostId, Value) VALUES ('19206579516945', -1)
To create a vote for a given post comment:
INSERT INTO Votes (PostId, CommentId, Value) VALUES ('19206579516945', '19244379733521', -1)
Delete
You must specify the Id of the vote to delete it.
DELETE FROM Votes WHERE Id = '19243214837905'
Columns
| Name | Type | ReadOnly | References | Description |
| Id [KEY] | Long | True |
The Id of the vote, automatically assigned when it is created. | |
| UserId | Long | True |
Users.Id |
The Id of the user who cast this vote. |
| ItemId | Long | True |
The Id of the item for which this vote was cast. | |
| ItemType | String | True |
The type of the item. Can be Article, Comment, Post or PostComment. | |
| Value | Integer | False |
The value of the vote, where 1 indicates up and -1 indicates down. The allowed values are 1, -1. | |
| Url | String | True |
The API URL of this vote. | |
| CreatedAt | Datetime | True |
The date and time when the vote was created. | |
| UpdatedAt | Datetime | True |
The date and time when the vote was last updated. |
Pseudo-Columns
Pseudo column fields are used in the WHERE clause of SELECT statements and offer more granular control over the data returned from the data source.
| Name | Type | Description |
| Locale | String |
The locale of the vote. |
| ArticleId | Long |
The Id of the article. |
| CommentId | Long |
The Id of the article comment or post comment. |
| PostId | Long |
The Id of the post. |