zendesk_api 0.1.11 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.travis.yml +1 -3
- data/Gemfile +24 -0
- data/Gemfile.lock +75 -10
- data/Procfile +1 -0
- data/Rakefile +10 -3
- data/Readme.md +65 -0
- data/bin/zendesk +26 -0
- data/config.ru +6 -0
- data/config/mongoid.yml +81 -0
- data/lib/zendesk_api/actions.rb +2 -2
- data/lib/zendesk_api/collection.rb +15 -4
- data/lib/zendesk_api/console/base.rb +12 -0
- data/lib/zendesk_api/console/console.rb +144 -0
- data/lib/zendesk_api/console/extensions.rb +183 -0
- data/lib/zendesk_api/console/options.rb +41 -0
- data/lib/zendesk_api/resource.rb +12 -1
- data/lib/zendesk_api/resources.rb +28 -8
- data/lib/zendesk_api/server/base.rb +119 -0
- data/lib/zendesk_api/server/docs/account_settings.md +145 -0
- data/lib/zendesk_api/server/docs/activity_stream.md +121 -0
- data/lib/zendesk_api/server/docs/attachments.md +73 -0
- data/lib/zendesk_api/server/docs/autocomplete.md +29 -0
- data/lib/zendesk_api/server/docs/categories.md +193 -0
- data/lib/zendesk_api/server/docs/custom_roles.md +88 -0
- data/lib/zendesk_api/server/docs/forum_subscriptions.md +139 -0
- data/lib/zendesk_api/server/docs/forums.md +229 -0
- data/lib/zendesk_api/server/docs/group_memberships.md +229 -0
- data/lib/zendesk_api/server/docs/groups.md +212 -0
- data/lib/zendesk_api/server/docs/introduction.md +159 -0
- data/lib/zendesk_api/server/docs/job_statuses.md +86 -0
- data/lib/zendesk_api/server/docs/locales.md +124 -0
- data/lib/zendesk_api/server/docs/macros.md +287 -0
- data/lib/zendesk_api/server/docs/organizations.md +253 -0
- data/lib/zendesk_api/server/docs/problems.md +117 -0
- data/lib/zendesk_api/server/docs/requests.md +256 -0
- data/lib/zendesk_api/server/docs/satisfaction_ratings.md +136 -0
- data/lib/zendesk_api/server/docs/search.md +106 -0
- data/lib/zendesk_api/server/docs/sharing_agreements.md +57 -0
- data/lib/zendesk_api/server/docs/side_loading.md +125 -0
- data/lib/zendesk_api/server/docs/suspended_tickets.md +182 -0
- data/lib/zendesk_api/server/docs/tags.md +36 -0
- data/lib/zendesk_api/server/docs/ticket_audits.md +657 -0
- data/lib/zendesk_api/server/docs/ticket_export.md +121 -0
- data/lib/zendesk_api/server/docs/ticket_fields.md +277 -0
- data/lib/zendesk_api/server/docs/ticket_import.md +65 -0
- data/lib/zendesk_api/server/docs/ticket_metrics.md +125 -0
- data/lib/zendesk_api/server/docs/tickets.md +622 -0
- data/lib/zendesk_api/server/docs/topic_comments.md +221 -0
- data/lib/zendesk_api/server/docs/topic_subscriptions.md +140 -0
- data/lib/zendesk_api/server/docs/topic_votes.md +154 -0
- data/lib/zendesk_api/server/docs/topics.md +335 -0
- data/lib/zendesk_api/server/docs/triggers.md +199 -0
- data/lib/zendesk_api/server/docs/user_identities.md +279 -0
- data/lib/zendesk_api/server/docs/users.md +400 -0
- data/lib/zendesk_api/server/docs/views.md +505 -0
- data/lib/zendesk_api/server/helper.rb +104 -0
- data/lib/zendesk_api/server/html_renderer.rb +98 -0
- data/lib/zendesk_api/server/models/user_request.rb +16 -0
- data/lib/zendesk_api/server/models/zlib_json.rb +13 -0
- data/lib/zendesk_api/server/public/config.rb +26 -0
- data/lib/zendesk_api/server/public/favicon.ico +0 -0
- data/lib/zendesk_api/server/public/images/glyphicons-halflings-white.png +0 -0
- data/lib/zendesk_api/server/public/images/glyphicons-halflings.png +0 -0
- data/lib/zendesk_api/server/public/images/spinner.gif +0 -0
- data/lib/zendesk_api/server/public/images/zendesk_developers_bg.png +0 -0
- data/lib/zendesk_api/server/public/images/zendesk_developers_header.png +0 -0
- data/lib/zendesk_api/server/public/javascripts/application.js +186 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-alert.js +90 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-button.js +96 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-carousel.js +169 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-collapse.js +157 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-dropdown.js +100 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-modal.js +218 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-popover.js +98 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-scrollspy.js +151 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-tab.js +135 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-tooltip.js +275 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-transition.js +61 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-typeahead.js +285 -0
- data/lib/zendesk_api/server/public/sass/screen.scss +102 -0
- data/lib/zendesk_api/server/public/sass/styles.scss +5 -0
- data/lib/zendesk_api/server/public/stylesheets/developer.screen.css +836 -0
- data/lib/zendesk_api/server/public/stylesheets/screen.css +129 -0
- data/lib/zendesk_api/server/public/stylesheets/styles.css +6208 -0
- data/lib/zendesk_api/server/templates/footer.haml +13 -0
- data/lib/zendesk_api/server/templates/header.haml +20 -0
- data/lib/zendesk_api/server/templates/index.haml +68 -0
- data/lib/zendesk_api/server/templates/layout.haml +44 -0
- data/lib/zendesk_api/server/templates/param.haml +4 -0
- data/lib/zendesk_api/server/templates/search.haml +23 -0
- data/lib/zendesk_api/server/templates/sidebar.haml +7 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/{association_spec.rb → core/association_spec.rb} +1 -1
- data/spec/{client_spec.rb → core/client_spec.rb} +1 -1
- data/spec/{collection_spec.rb → core/collection_spec.rb} +1 -1
- data/spec/{configuration_spec.rb → core/configuration_spec.rb} +1 -1
- data/spec/{create_resource_spec.rb → core/create_resource_spec.rb} +1 -1
- data/spec/{data_resource_spec.rb → core/data_resource_spec.rb} +1 -1
- data/spec/{inflection_spec.rb → core/inflection_spec.rb} +1 -1
- data/spec/{lru_cache_spec.rb → core/lru_cache_spec.rb} +1 -1
- data/spec/{middleware → core/middleware}/request/etag_cache_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/request/retry_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/request/test.jpg +0 -0
- data/spec/{middleware → core/middleware}/request/upload_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/callback_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/deflate_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/gzip_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/parse_iso_dates_spec.rb +1 -1
- data/spec/{read_resource_spec.rb → core/read_resource_spec.rb} +1 -1
- data/spec/{rescue_spec.rb → core/rescue_spec.rb} +1 -1
- data/spec/{resource_spec.rb → core/resource_spec.rb} +1 -1
- data/spec/{search_spec.rb → core/search_spec.rb} +1 -1
- data/spec/{spec_helper.rb → core/spec_helper.rb} +5 -5
- data/spec/{trackie_spec.rb → core/trackie_spec.rb} +1 -1
- data/{live → spec/live}/Readme.md +0 -0
- data/{live → spec/live}/activity_spec.rb +1 -1
- data/{live → spec/live}/audit_spec.rb +1 -1
- data/{live → spec/live}/bookmark_spec.rb +1 -1
- data/{live → spec/live}/category_spec.rb +1 -1
- data/{live → spec/live}/collection_spec.rb +1 -1
- data/{live → spec/live}/crm_spec.rb +1 -1
- data/{live → spec/live}/custom_role_spec.rb +1 -1
- data/{live → spec/live}/forum_spec.rb +1 -1
- data/{live → spec/live}/forum_subscription_spec.rb +1 -1
- data/{live → spec/live}/group_membership_spec.rb +1 -1
- data/{live → spec/live}/group_spec.rb +1 -1
- data/{live → spec/live}/identity_spec.rb +1 -1
- data/{live → spec/live}/locale_spec.rb +1 -1
- data/{live → spec/live}/macro_spec.rb +1 -1
- data/{live → spec/live}/mobile_device_spec.rb +1 -1
- data/{live → spec/live}/organization_spec.rb +1 -1
- data/{live → spec/live}/request_spec.rb +1 -1
- data/{live → spec/live}/satisfaction_rating_spec.rb +1 -1
- data/{live → spec/live}/setting_spec.rb +1 -1
- data/{live → spec/live}/suspended_ticket_spec.rb +1 -1
- data/{live → spec/live}/ticket_field_spec.rb +1 -1
- data/{live → spec/live}/ticket_metrics_spec.rb +1 -1
- data/{live → spec/live}/ticket_spec.rb +1 -1
- data/spec/live/topic_comment_spec.rb +24 -0
- data/{live → spec/live}/topic_spec.rb +1 -1
- data/{live → spec/live}/topic_subscription_spec.rb +1 -1
- data/{live → spec/live}/topic_vote_spec.rb +1 -1
- data/{live → spec/live}/upload_spec.rb +1 -1
- data/{live → spec/live}/user_spec.rb +1 -1
- data/{live → spec/live}/view_spec.rb +1 -1
- data/spec/macros/resource_macros.rb +1 -1
- data/spec/server/app_spec.rb +140 -0
- data/spec/server/helper_spec.rb +97 -0
- data/spec/server/html_renderer_spec.rb +130 -0
- data/spec/server/spec_helper.rb +43 -0
- metadata +198 -77
- 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
|
+
```
|