zendesk_api 0.1.11 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. data/.gitignore +3 -0
  2. data/.travis.yml +1 -3
  3. data/Gemfile +24 -0
  4. data/Gemfile.lock +75 -10
  5. data/Procfile +1 -0
  6. data/Rakefile +10 -3
  7. data/Readme.md +65 -0
  8. data/bin/zendesk +26 -0
  9. data/config.ru +6 -0
  10. data/config/mongoid.yml +81 -0
  11. data/lib/zendesk_api/actions.rb +2 -2
  12. data/lib/zendesk_api/collection.rb +15 -4
  13. data/lib/zendesk_api/console/base.rb +12 -0
  14. data/lib/zendesk_api/console/console.rb +144 -0
  15. data/lib/zendesk_api/console/extensions.rb +183 -0
  16. data/lib/zendesk_api/console/options.rb +41 -0
  17. data/lib/zendesk_api/resource.rb +12 -1
  18. data/lib/zendesk_api/resources.rb +28 -8
  19. data/lib/zendesk_api/server/base.rb +119 -0
  20. data/lib/zendesk_api/server/docs/account_settings.md +145 -0
  21. data/lib/zendesk_api/server/docs/activity_stream.md +121 -0
  22. data/lib/zendesk_api/server/docs/attachments.md +73 -0
  23. data/lib/zendesk_api/server/docs/autocomplete.md +29 -0
  24. data/lib/zendesk_api/server/docs/categories.md +193 -0
  25. data/lib/zendesk_api/server/docs/custom_roles.md +88 -0
  26. data/lib/zendesk_api/server/docs/forum_subscriptions.md +139 -0
  27. data/lib/zendesk_api/server/docs/forums.md +229 -0
  28. data/lib/zendesk_api/server/docs/group_memberships.md +229 -0
  29. data/lib/zendesk_api/server/docs/groups.md +212 -0
  30. data/lib/zendesk_api/server/docs/introduction.md +159 -0
  31. data/lib/zendesk_api/server/docs/job_statuses.md +86 -0
  32. data/lib/zendesk_api/server/docs/locales.md +124 -0
  33. data/lib/zendesk_api/server/docs/macros.md +287 -0
  34. data/lib/zendesk_api/server/docs/organizations.md +253 -0
  35. data/lib/zendesk_api/server/docs/problems.md +117 -0
  36. data/lib/zendesk_api/server/docs/requests.md +256 -0
  37. data/lib/zendesk_api/server/docs/satisfaction_ratings.md +136 -0
  38. data/lib/zendesk_api/server/docs/search.md +106 -0
  39. data/lib/zendesk_api/server/docs/sharing_agreements.md +57 -0
  40. data/lib/zendesk_api/server/docs/side_loading.md +125 -0
  41. data/lib/zendesk_api/server/docs/suspended_tickets.md +182 -0
  42. data/lib/zendesk_api/server/docs/tags.md +36 -0
  43. data/lib/zendesk_api/server/docs/ticket_audits.md +657 -0
  44. data/lib/zendesk_api/server/docs/ticket_export.md +121 -0
  45. data/lib/zendesk_api/server/docs/ticket_fields.md +277 -0
  46. data/lib/zendesk_api/server/docs/ticket_import.md +65 -0
  47. data/lib/zendesk_api/server/docs/ticket_metrics.md +125 -0
  48. data/lib/zendesk_api/server/docs/tickets.md +622 -0
  49. data/lib/zendesk_api/server/docs/topic_comments.md +221 -0
  50. data/lib/zendesk_api/server/docs/topic_subscriptions.md +140 -0
  51. data/lib/zendesk_api/server/docs/topic_votes.md +154 -0
  52. data/lib/zendesk_api/server/docs/topics.md +335 -0
  53. data/lib/zendesk_api/server/docs/triggers.md +199 -0
  54. data/lib/zendesk_api/server/docs/user_identities.md +279 -0
  55. data/lib/zendesk_api/server/docs/users.md +400 -0
  56. data/lib/zendesk_api/server/docs/views.md +505 -0
  57. data/lib/zendesk_api/server/helper.rb +104 -0
  58. data/lib/zendesk_api/server/html_renderer.rb +98 -0
  59. data/lib/zendesk_api/server/models/user_request.rb +16 -0
  60. data/lib/zendesk_api/server/models/zlib_json.rb +13 -0
  61. data/lib/zendesk_api/server/public/config.rb +26 -0
  62. data/lib/zendesk_api/server/public/favicon.ico +0 -0
  63. data/lib/zendesk_api/server/public/images/glyphicons-halflings-white.png +0 -0
  64. data/lib/zendesk_api/server/public/images/glyphicons-halflings.png +0 -0
  65. data/lib/zendesk_api/server/public/images/spinner.gif +0 -0
  66. data/lib/zendesk_api/server/public/images/zendesk_developers_bg.png +0 -0
  67. data/lib/zendesk_api/server/public/images/zendesk_developers_header.png +0 -0
  68. data/lib/zendesk_api/server/public/javascripts/application.js +186 -0
  69. data/lib/zendesk_api/server/public/javascripts/bootstrap-alert.js +90 -0
  70. data/lib/zendesk_api/server/public/javascripts/bootstrap-button.js +96 -0
  71. data/lib/zendesk_api/server/public/javascripts/bootstrap-carousel.js +169 -0
  72. data/lib/zendesk_api/server/public/javascripts/bootstrap-collapse.js +157 -0
  73. data/lib/zendesk_api/server/public/javascripts/bootstrap-dropdown.js +100 -0
  74. data/lib/zendesk_api/server/public/javascripts/bootstrap-modal.js +218 -0
  75. data/lib/zendesk_api/server/public/javascripts/bootstrap-popover.js +98 -0
  76. data/lib/zendesk_api/server/public/javascripts/bootstrap-scrollspy.js +151 -0
  77. data/lib/zendesk_api/server/public/javascripts/bootstrap-tab.js +135 -0
  78. data/lib/zendesk_api/server/public/javascripts/bootstrap-tooltip.js +275 -0
  79. data/lib/zendesk_api/server/public/javascripts/bootstrap-transition.js +61 -0
  80. data/lib/zendesk_api/server/public/javascripts/bootstrap-typeahead.js +285 -0
  81. data/lib/zendesk_api/server/public/sass/screen.scss +102 -0
  82. data/lib/zendesk_api/server/public/sass/styles.scss +5 -0
  83. data/lib/zendesk_api/server/public/stylesheets/developer.screen.css +836 -0
  84. data/lib/zendesk_api/server/public/stylesheets/screen.css +129 -0
  85. data/lib/zendesk_api/server/public/stylesheets/styles.css +6208 -0
  86. data/lib/zendesk_api/server/templates/footer.haml +13 -0
  87. data/lib/zendesk_api/server/templates/header.haml +20 -0
  88. data/lib/zendesk_api/server/templates/index.haml +68 -0
  89. data/lib/zendesk_api/server/templates/layout.haml +44 -0
  90. data/lib/zendesk_api/server/templates/param.haml +4 -0
  91. data/lib/zendesk_api/server/templates/search.haml +23 -0
  92. data/lib/zendesk_api/server/templates/sidebar.haml +7 -0
  93. data/lib/zendesk_api/version.rb +1 -1
  94. data/spec/{association_spec.rb → core/association_spec.rb} +1 -1
  95. data/spec/{client_spec.rb → core/client_spec.rb} +1 -1
  96. data/spec/{collection_spec.rb → core/collection_spec.rb} +1 -1
  97. data/spec/{configuration_spec.rb → core/configuration_spec.rb} +1 -1
  98. data/spec/{create_resource_spec.rb → core/create_resource_spec.rb} +1 -1
  99. data/spec/{data_resource_spec.rb → core/data_resource_spec.rb} +1 -1
  100. data/spec/{inflection_spec.rb → core/inflection_spec.rb} +1 -1
  101. data/spec/{lru_cache_spec.rb → core/lru_cache_spec.rb} +1 -1
  102. data/spec/{middleware → core/middleware}/request/etag_cache_spec.rb +1 -1
  103. data/spec/{middleware → core/middleware}/request/retry_spec.rb +1 -1
  104. data/spec/{middleware → core/middleware}/request/test.jpg +0 -0
  105. data/spec/{middleware → core/middleware}/request/upload_spec.rb +1 -1
  106. data/spec/{middleware → core/middleware}/response/callback_spec.rb +1 -1
  107. data/spec/{middleware → core/middleware}/response/deflate_spec.rb +1 -1
  108. data/spec/{middleware → core/middleware}/response/gzip_spec.rb +1 -1
  109. data/spec/{middleware → core/middleware}/response/parse_iso_dates_spec.rb +1 -1
  110. data/spec/{read_resource_spec.rb → core/read_resource_spec.rb} +1 -1
  111. data/spec/{rescue_spec.rb → core/rescue_spec.rb} +1 -1
  112. data/spec/{resource_spec.rb → core/resource_spec.rb} +1 -1
  113. data/spec/{search_spec.rb → core/search_spec.rb} +1 -1
  114. data/spec/{spec_helper.rb → core/spec_helper.rb} +5 -5
  115. data/spec/{trackie_spec.rb → core/trackie_spec.rb} +1 -1
  116. data/{live → spec/live}/Readme.md +0 -0
  117. data/{live → spec/live}/activity_spec.rb +1 -1
  118. data/{live → spec/live}/audit_spec.rb +1 -1
  119. data/{live → spec/live}/bookmark_spec.rb +1 -1
  120. data/{live → spec/live}/category_spec.rb +1 -1
  121. data/{live → spec/live}/collection_spec.rb +1 -1
  122. data/{live → spec/live}/crm_spec.rb +1 -1
  123. data/{live → spec/live}/custom_role_spec.rb +1 -1
  124. data/{live → spec/live}/forum_spec.rb +1 -1
  125. data/{live → spec/live}/forum_subscription_spec.rb +1 -1
  126. data/{live → spec/live}/group_membership_spec.rb +1 -1
  127. data/{live → spec/live}/group_spec.rb +1 -1
  128. data/{live → spec/live}/identity_spec.rb +1 -1
  129. data/{live → spec/live}/locale_spec.rb +1 -1
  130. data/{live → spec/live}/macro_spec.rb +1 -1
  131. data/{live → spec/live}/mobile_device_spec.rb +1 -1
  132. data/{live → spec/live}/organization_spec.rb +1 -1
  133. data/{live → spec/live}/request_spec.rb +1 -1
  134. data/{live → spec/live}/satisfaction_rating_spec.rb +1 -1
  135. data/{live → spec/live}/setting_spec.rb +1 -1
  136. data/{live → spec/live}/suspended_ticket_spec.rb +1 -1
  137. data/{live → spec/live}/ticket_field_spec.rb +1 -1
  138. data/{live → spec/live}/ticket_metrics_spec.rb +1 -1
  139. data/{live → spec/live}/ticket_spec.rb +1 -1
  140. data/spec/live/topic_comment_spec.rb +24 -0
  141. data/{live → spec/live}/topic_spec.rb +1 -1
  142. data/{live → spec/live}/topic_subscription_spec.rb +1 -1
  143. data/{live → spec/live}/topic_vote_spec.rb +1 -1
  144. data/{live → spec/live}/upload_spec.rb +1 -1
  145. data/{live → spec/live}/user_spec.rb +1 -1
  146. data/{live → spec/live}/view_spec.rb +1 -1
  147. data/spec/macros/resource_macros.rb +1 -1
  148. data/spec/server/app_spec.rb +140 -0
  149. data/spec/server/helper_spec.rb +97 -0
  150. data/spec/server/html_renderer_spec.rb +130 -0
  151. data/spec/server/spec_helper.rb +43 -0
  152. metadata +198 -77
  153. data/live/topic_comment_spec.rb +0 -13
@@ -0,0 +1,221 @@
1
+ ## Topic Comments
2
+
3
+ ### JSON Format
4
+ TopicComments are represented as simple flat JSON objects which have the following keys:
5
+
6
+ | Name | Type | Read-only | Mandatory | Comment
7
+ | --------------- | ------- | --------- | --------- | -------
8
+ | id | integer | yes | no | Automatically assigned upon creation
9
+ | url | string | yes | no | The API url of this topic comment
10
+ | topic_id | integer | no | yes | The id of the topic this comment was made on
11
+ | user_id | integer | no | yes | The id of the user making the topic comment
12
+ | body | string | no | yes | The comment body
13
+ | informative | boolean | no | no | If the comment has been flagged as informative
14
+ | attachments | array | yes | no | Attachments to this comment as [Attachment](attachments.md) objects
15
+ | created_at | date | yes | no | The time the topic_comment was created
16
+ | updated_at | date | yes | no | The time of the last update of the topic_comment
17
+
18
+ #### Example
19
+ ```js
20
+ {
21
+ "id": 35436,
22
+ "url": "https://company.zendesk.com/api/v2/topics/118/comments/35436.json",
23
+ "topic_id": 118,
24
+ "user_id": 9442,
25
+ "body": "I think this is a great topic",
26
+ "informative": false,
27
+ "attachments": [
28
+ {
29
+ "id": 498483,
30
+ "name": "crash.log",
31
+ "content_url": "https://company.zendesk.com/attachments/crash.log",
32
+ "content_type": "text/plain",
33
+ "size": 2532,
34
+ "thumbnails": []
35
+ }
36
+ ]
37
+ "created_at": "2009-07-20T22:55:29Z",
38
+ "updated_at": "2011-05-05T10:38:52Z"
39
+ }
40
+ ```
41
+
42
+ ### List Topic Comments
43
+ `GET /api/v2/topics/{id}/comments.json`
44
+
45
+ `GET /api/v2/users/{id}/topic_comments.json`
46
+
47
+ #### Allowed For:
48
+
49
+ * Admins on non-enterprise accounts
50
+ * Admins and agents will full forum access on enterprise accounts
51
+ * Users in general as permitted by the forum the topic is in
52
+
53
+ #### Using curl
54
+
55
+ ```bash
56
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/comments.json \
57
+ -v -u {email_address}:{password}
58
+ ```
59
+
60
+ #### Example Response
61
+
62
+ ```http
63
+ Status: 200 OK
64
+
65
+ {
66
+ "topic_comments": [
67
+ {
68
+ "id": 35436,
69
+ "topic_id": 118,
70
+ "user_id": 9442,
71
+ "body": "I think this is a great topic",
72
+ "informative": false,
73
+ "attachments": []
74
+ "created_at": "2012-02-20T22:55:29Z",
75
+ "updated_at": "2012-03-05T10:38:52Z"
76
+ },
77
+ {
78
+ "id": 54438,
79
+ "topic_id": 118,
80
+ "user_id": 1423,
81
+ "body": "This topic is not quite for me",
82
+ "informative": true,
83
+ "attachments": []
84
+ "created_at": "2012-03-20T22:55:29Z",
85
+ "updated_at": "2012-03-20T22:55:29Z"
86
+ }
87
+ ]
88
+ }
89
+ ```
90
+
91
+ ### Show Topic Comment
92
+ `GET /api/v2/topics/{topic_id}/comments/{id}.json`
93
+
94
+ `GET /api/v2/users/{user_id}/topic_comments/{id}.json`
95
+
96
+ #### Allowed For
97
+
98
+ * Admins on non-enterprise accounts
99
+ * Admins and agents will full forum access on enterprise accounts
100
+ * Users in general as permitted by the forum the topic is in
101
+
102
+ #### Using curl
103
+
104
+ ```bash
105
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{topic_id}/comments/{id}.json \
106
+ -v -u {email_address}:{password}
107
+ ```
108
+
109
+ #### Example Response
110
+
111
+ ```http
112
+ Status: 200 OK
113
+
114
+ {
115
+ "topic_comment": {
116
+ "id": 35436,
117
+ "topic_id": 118,
118
+ "user_id": 9442,
119
+ "body": "I think this is a great topic",
120
+ "informative": false,
121
+ "attachments": []
122
+ "created_at": "2012-02-20T22:55:29Z",
123
+ "updated_at": "2012-03-05T10:38:52Z"
124
+ }
125
+ }
126
+ ```
127
+
128
+ ### Create Topic Comment
129
+ `POST /api/v2/topics/{id}/comments.json`
130
+
131
+ #### Allowed For
132
+
133
+ * Users in general as permitted by the forum the topic is in
134
+
135
+ #### Using curl
136
+
137
+ ```bash
138
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/comments.json \
139
+ -H "Content-Type: application/json" -d '{"topic_comment": {"body": "A man walks into a bar"}}' \
140
+ -v -u {email_address}:{password} -X POST
141
+ ```
142
+
143
+ #### Example Response
144
+
145
+ ```http
146
+ Status: 201 Created
147
+ Location: https://{subdomain}.zendesk.com/api/v2/topics/{topic_id}/comments/{id}.json
148
+
149
+ {
150
+ "topic_comment": {
151
+ "id": 35436,
152
+ "topic_id": 118,
153
+ "user_id": 9442,
154
+ "body": "A man walks into a bar",
155
+ "informative": false,
156
+ "attachments": []
157
+ "created_at": "2012-03-05T10:38:52Z",
158
+ "updated_at": "2012-03-05T10:38:52Z"
159
+ }
160
+ }
161
+ ```
162
+
163
+ ### Update Topic Comment
164
+ `PUT /api/v2/topics/{topic_id}/comments/{id}.json`
165
+
166
+ #### Allowed For
167
+
168
+ These are subject to the current permission settings on the enclosing account
169
+
170
+ * Admins on non-enterprise accounts
171
+ * Admins and agents will full forum access on enterprise accounts
172
+ * The user who created the original comment
173
+
174
+ #### Using curl
175
+
176
+ ```bash
177
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{topic_id}/comments/{id}.json \
178
+ -H "Content-Type: application/json" -d '{"topic_comment": {"body": "A woman walks into a bar"}}' \
179
+ -v -u {email_address}:{password} -X PUT
180
+ ```
181
+
182
+ #### Example Response
183
+
184
+ ```http
185
+ Status: 200 OK
186
+
187
+ {
188
+ "topic_comment": {
189
+ "id": 35436,
190
+ "topic_id": 118,
191
+ "user_id": 9442,
192
+ "body": "A woman walks into a bar",
193
+ "informative": false,
194
+ "attachments": []
195
+ "created_at": "2012-03-05T10:38:52Z",
196
+ "updated_at": "2012-03-05T12:38:52Z"
197
+ }
198
+ }
199
+ ```
200
+
201
+ ### Delete Topic Comment
202
+ `DELETE /api/v2/topics/{topic_id}/comments/{id}.json`
203
+
204
+ #### Allowed For
205
+
206
+ * Admins on non-enterprise accounts
207
+ * Admins and agents will full forum access on enterprise accounts
208
+ * The user who created the original comment
209
+
210
+ #### Using curl
211
+
212
+ ```bash
213
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{topic_id}/comments/{id}.json \
214
+ -v -u {email_address}:{password} -X DELETE
215
+ ```
216
+
217
+ #### Example Response
218
+
219
+ ```http
220
+ Status: 200 OK
221
+ ```
@@ -0,0 +1,140 @@
1
+ ## Topic Subscriptions
2
+
3
+ ### JSON Format
4
+ Topic subscriptions are links between users and topics they subscribe to
5
+
6
+ | Name | Type | Read-only | Mandatory | Comment
7
+ | --------------- | ------- | --------- | --------- | -------
8
+ | id | integer | yes | no | Automatically assigned upon creation
9
+ | topic_id | integer | no | yes | The topic being subscribed to
10
+ | user_id | integer | no | yes | The user subscribed to the forum
11
+ | created_at | date | yes | no | The time the subscription was created
12
+
13
+ #### Example
14
+ ```js
15
+ {
16
+ "id": 35436,
17
+ "url": "https://company.zendesk.com/api/v2/topic_subscriptions/35436.json",
18
+ "topic_id": 32,
19
+ "user_id": 482,
20
+ "created_at": "2009-07-20T22:55:29Z"
21
+ }
22
+ ```
23
+
24
+ ### List Topic Subscriptions
25
+ `GET /api/v2/topic/{topic_id}/subscriptions.json`
26
+
27
+ `GET /api/v2/topic_subscriptions.json`
28
+
29
+ #### Allowed For:
30
+
31
+ * Agents
32
+
33
+ #### Using curl
34
+
35
+ ```bash
36
+ curl https://{subdomain}.zendesk.com/api/v2/topic_subscriptions.json \
37
+ -v -u {email_address}:{password}
38
+ ```
39
+
40
+ #### Example Response
41
+
42
+ ```http
43
+ Status: 200 OK
44
+
45
+ {
46
+ "topic_subscriptions": [
47
+ {
48
+ "id": 35436,
49
+ "topic_id": 32,
50
+ "user_id": 482,
51
+ "created_at": "2009-07-20T22:55:29Z"
52
+ },
53
+ {
54
+ "id": 43681,
55
+ "topic_id": 334,
56
+ "user_id": 9471,
57
+ "created_at": "2011-08-22T21:12:09Z"
58
+ }
59
+ ]
60
+ }
61
+ ```
62
+
63
+ ### Show Topic Subscription
64
+ `GET /api/v2/topic_subscriptions/{id}.json`
65
+
66
+ #### Allowed For:
67
+
68
+ * Agents
69
+
70
+ #### Using curl
71
+
72
+ ```bash
73
+ curl https://{subdomain}.zendesk.com/api/v2/topic_subscriptions/{id}.json \
74
+ -v -u {email_address}:{password}
75
+ ```
76
+
77
+ #### Example Response
78
+
79
+ ```http
80
+ Status: 200 OK
81
+
82
+ {
83
+ "topic_subscription": {
84
+ "id": 35436,
85
+ "topic_id": 32,
86
+ "user_id": 482,
87
+ "created_at": "2009-07-20T22:55:29Z"
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### Create Topic Subscription
93
+ `POST /api/v2/topic_subscriptions.json`
94
+
95
+ #### Allowed For:
96
+
97
+ * Agents
98
+
99
+ #### Using curl
100
+
101
+ ```bash
102
+ curl https://{subdomain}.zendesk.com/api/v2/topic_subscriptions.json \
103
+ -d '{"user_id": 772, "topic_id": 881}' \
104
+ -v -u {email_address}:{password} -X POST
105
+ ```
106
+
107
+ #### Example Response
108
+
109
+ ```http
110
+ Status: 200 OK
111
+
112
+ {
113
+ "topic_subscription": {
114
+ "id": 55436,
115
+ "topic_id": 881,
116
+ "user_id": 772,
117
+ "created_at": "2012-04-20T22:55:29Z"
118
+ }
119
+ }
120
+ ```
121
+
122
+ ### Delete Topic Subscription
123
+ `DELETE /api/v2/topic_subscriptions/{id}.json`
124
+
125
+ #### Allowed For
126
+
127
+ * Agents
128
+
129
+ #### Using curl
130
+
131
+ ```bash
132
+ curl https://{subdomain}.zendesk.com/api/v2/topic_subscriptions/{id}.json \
133
+ -v -u {email_address}:{password} -X DELETE
134
+ ```
135
+
136
+ #### Example Response
137
+
138
+ ```http
139
+ Status: 200 OK
140
+ ```
@@ -0,0 +1,154 @@
1
+ ## Topic Votes
2
+
3
+ ### JSON Format
4
+ Topic votes have the following keys:
5
+
6
+ | Name | Type | Read-only | Mandatory | Comment
7
+ | --------------- | ------- | --------- | --------- | -------
8
+ | id | integer | yes | no | Automatically assigned when creating a vote
9
+ | user_id | integer | yes | yes | The id of the user who votes on the topic
10
+ | topic_id | integer | yes | yes | The id of the topic voted on
11
+ | created_at | date | yes | no | The time the vote was cast
12
+
13
+ #### Example
14
+ ```js
15
+ {
16
+ "id": 35436,
17
+ "user_id": 135,
18
+ "topic_id": 559,
19
+ "created_at": "2011-07-20T22:55:29Z"
20
+ }
21
+ ```
22
+
23
+ ### List Topic Votes
24
+
25
+ Allows agents to see votes cast on a topic or by a specific user.
26
+
27
+ `GET /api/v2/topics/{id}/votes.json`
28
+
29
+ `GET /api/v2/users/{id}/topic_votes.json`
30
+
31
+ #### Allowed For:
32
+
33
+ * Agents
34
+
35
+ #### Using curl
36
+
37
+ ```bash
38
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/votes.json \
39
+ -v -u {email_address}:{password}
40
+ ```
41
+
42
+ #### Example Response
43
+
44
+ ```http
45
+ Status: 200 OK
46
+
47
+ {
48
+ "topic_votes": [
49
+ {
50
+ "id": 35436,
51
+ "user_id": 135,
52
+ "topic_id": 559,
53
+ "created_at": "2011-07-20T22:55:29Z"
54
+ },
55
+ {
56
+ "id": 39316,
57
+ "user_id": 85,
58
+ "topic_id": 559,
59
+ "created_at": "2012-01-10T12:53:42Z"
60
+ }
61
+ ]
62
+ }
63
+ ```
64
+
65
+ Agents can pass a `user_id={user_id}` to all actions below to control voting for specific users.
66
+
67
+
68
+ ### Check for Vote
69
+ `GET /api/v2/topics/{id}/vote.json`
70
+
71
+ #### Allowed For
72
+
73
+ * Anyone who is logged in
74
+
75
+ #### Using curl
76
+
77
+ ```bash
78
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/vote.json \
79
+ -v -u {email_address}:{password}
80
+ ```
81
+
82
+ #### Example Response
83
+
84
+ If the current user has not cast a vote in the topic
85
+
86
+ ```http
87
+ Status: 404 Not Found
88
+ ```
89
+
90
+ If the current user has cast a vote in the topic
91
+
92
+ ```http
93
+ Status: 200 OK
94
+
95
+ {
96
+ "topic_vote": {
97
+ "id": 35436,
98
+ "user_id": 135,
99
+ "topic_id": 559,
100
+ "created_at": "2011-07-20T22:55:29Z"
101
+ }
102
+ }
103
+ ```
104
+
105
+ ### Create Vote
106
+ `POST /api/v2/topics/{id}/vote.json`
107
+
108
+ #### Allowed For
109
+
110
+ * Any logged in user who has not already cast a vote in the given topic
111
+
112
+ #### Using curl
113
+
114
+ ```bash
115
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/vote.json \
116
+ -H "Content-Type: application/json" -X POST -v -u {email_address}:{password}
117
+ ```
118
+
119
+ #### Example Response
120
+
121
+ ```http
122
+ Status: 201 Created
123
+ Location: https://{subdomain}.zendesk.com/api/v2/topics/{id}.json
124
+
125
+ {
126
+ "topic_vote": {
127
+ "id": 35436,
128
+ "user_id": 135,
129
+ "topic_id": 559,
130
+ "created_at": "2012-03-20T22:55:29Z"
131
+ }
132
+ }
133
+ ```
134
+
135
+ ### Delete Vote
136
+ `DELETE /api/v2/topics/{id}/vote.json`
137
+
138
+ #### Allowed For
139
+
140
+ * The user who cast the vote
141
+ * Agents
142
+
143
+ #### Using curl
144
+
145
+ ```bash
146
+ curl https://{subdomain}.zendesk.com/api/v2/topics/{id}/vote.json \
147
+ -H "Content-Type: application/json" -X DELETE -v -u {email_address}:{password}
148
+ ```
149
+
150
+ #### Example Response
151
+
152
+ ```http
153
+ Status: 200 OK
154
+ ```