Topic votes have the following keys:
| Name | Type | Read-only | Mandatory | Comment |
|---|---|---|---|---|
| id | integer | yes | no | Automatically assigned when creating a vote |
| user_id | integer | yes | yes | The id of the user who votes on the topic |
| topic_id | integer | yes | yes | The id of the topic voted on |
| created_at | date | yes | no | The time the vote was cast |
{
"id": 35436,
"user_id": 135,
"topic_id": 559,
"created_at": "2011-07-20T22:55:29Z"
}
Allows agents to see votes cast on a topic or by a specific user.
GET /api/v2/topics/{id}/votes.json
GET /api/v2/users/{id}/topic_votes.json
curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/votes.json \
-v -u {email_address}:{password}
Status: 200 OK
{
"topic_votes": [
{
"id": 35436,
"user_id": 135,
"topic_id": 559,
"created_at": "2011-07-20T22:55:29Z"
},
{
"id": 39316,
"user_id": 85,
"topic_id": 559,
"created_at": "2012-01-10T12:53:42Z"
}
]
}
Agents can pass a user_id={user_id} to all actions below to control voting for specific users.
GET /api/v2/topics/{id}/vote.json
curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/vote.json \
-v -u {email_address}:{password}
If the current user has not cast a vote in the topic
Status: 404 Not Found
If the current user has cast a vote in the topic
Status: 200 OK
{
"topic_vote": {
"id": 35436,
"user_id": 135,
"topic_id": 559,
"created_at": "2011-07-20T22:55:29Z"
}
}
POST /api/v2/topics/{id}/vote.json
curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/vote.json \
-H "Content-Type: application/json" -X POST -v -u {email_address}:{password}
Status: 201 Created
Location: https://{subdomain}.zendesk.com/api/v2/topics/{id}.json
{
"topic_vote": {
"id": 35436,
"user_id": 135,
"topic_id": 559,
"created_at": "2012-03-20T22:55:29Z"
}
}
DELETE /api/v2/topics/{id}/vote.json
curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/vote.json \
-H "Content-Type: application/json" -X DELETE -v -u {email_address}:{password}
Status: 200 OK