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.
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,505 @@
1
+ ## Views
2
+
3
+ ### JSON Format
4
+ Views are read-only and represented as simple flat JSON objects which have the following keys.
5
+
6
+ | Name | Type | Comment
7
+ | --------------- | ---------------------------| -------------------
8
+ | id | integer | Automatically assigned when created
9
+ | title | string | The title of the view
10
+ | active | boolean | Useful for determining if the view should be displayed
11
+ | restriction | object | Who may access this account. Will be null when everyone in the account can access it.
12
+ | execution | [Execute](#execution) | An object describing how the view should be executed
13
+ | conditions | [Conditions](#conditions) | An object describing how the view is constructed
14
+ | created_at | date | The time the view was created
15
+ | updated_at | date | The time of the last update of the view
16
+
17
+ #### Example
18
+ ```js
19
+ {
20
+ "view": {
21
+ "id": 25,
22
+ "title": "Tickets updated <12 Hours",
23
+ "active": true,
24
+ "execution": { ... },
25
+ "conditions": [ ... ],
26
+ "restriction": {
27
+ "type": "User",
28
+ "id": 4
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ### Execution
35
+ View Execution is a read-only object that describes how to display a collection of tickets in a View.
36
+
37
+ | Name | Type | Comment
38
+ | --------------- | ------- | -------
39
+ | fields | Array | The ticket fields to display. System fields have a string id.
40
+ | custom_fields | Array | The custom ticket fields to display. Custom fields have an id and url referencing the [Ticket Field](ticket_fields.md)
41
+ | group_by | String | When present, the field by which the tickets are grouped
42
+ | group_order | String | The direction the tickets are grouped. May be one of 'asc' or 'desc'
43
+ | sort_order | String | The direction the tickets are sorted. May be one of 'asc' or 'desc'
44
+ | sort_by | String | The ticket field used for sorting. This will either be a title or a custom field id.
45
+
46
+ #### Example
47
+ ```js
48
+ {
49
+ "execution":{
50
+ "fields": [
51
+ { "id": "status", "title": "Status" },
52
+ { "id": "updated", "title": "Updated" }
53
+ ],
54
+ "custom_fields": [
55
+ {
56
+ "id": 5, "title": "Account",
57
+ "url": "https://example.zendesk.com/api/v2/ticket_fields/5.json"
58
+ },
59
+ ...
60
+ ]
61
+ "group_by":null,
62
+ "sort_order":"desc",
63
+ "sort_by":"updated"
64
+ }
65
+ }
66
+ ```
67
+
68
+ ### Conditions
69
+ The conditions under which a ticket is selected.
70
+
71
+ | Name | Type | Comment
72
+ | ------------ | ------- | -------
73
+ | all | array | Tickets must fulfill *all* of these conditions to be considered matching
74
+ | any | array | Tickets may satisfy *any* of these conditions to be considered matching
75
+
76
+ #### Example
77
+ ```js
78
+ {
79
+ "conditions": {
80
+ "all": [
81
+ { "field": "status", "operator": "less_than", "value": "solved" },
82
+ { "field": "assignee", "operator": "is", "value": "me" },
83
+ ],
84
+ "any": [
85
+ ]
86
+ }
87
+ }
88
+ ```
89
+
90
+ <!---
91
+
92
+ ### View Rows
93
+
94
+ View Rows are read-only and represented as simple flat JSON objects which have the following keys.
95
+
96
+ | Name | Type | Comment
97
+ | --------------- | --------------------------- | -------------------
98
+ | view | Array | View that was executed. Consists of id and url.
99
+ | rows | Array | Array of tickets contained in the view, described by the fields.
100
+ | columns | Array | Array of [Fields](#execution) and [Custom Fields](#execution) representing the columns in each row.
101
+
102
+ A row contains the data indicated by the idenitifiers in the columns array.
103
+
104
+ | Name | Type | Optional | Comment
105
+ | ---------------------- | ---------------------------- | --------- | ----------------
106
+ | ticket | Object | no | Ticket id, url, subject, description, status, type, priority and comment this row is a subset of.
107
+ | custom_fields | Array | no | Custom fields values.
108
+ | group | Integer | yes | Id of this ticket's group.
109
+ | organization | Integer | yes | Id of this ticket's organization.
110
+ | requester | Integer | yes | Id of this ticket's requester.
111
+ | assignee | Integer | yes | Id of this ticket's assignee.
112
+ | submitter | Integer | yes | Id of this ticket's submitter.
113
+ | locale | String | yes | Locale of the requester.
114
+ | type | String | yes | See [Ticket](tickets.md#json-format)
115
+ | priority | String | yes | See [Ticket](tickets.md#json-format)
116
+ | status | String | yes | See [Ticket](tickets.md#json-format)
117
+ | updated_by_type | String | yes | Last updated by 'agent' or 'end user'
118
+ | subject | DateTime | yes | Ticket subject.
119
+ | requester_updated_at | DateTime | yes | When the requester last updated the ticket.
120
+ | assignee_updated_at | DateTime | yes | When the assignee last updated the ticket.
121
+ | assigned | DateTime | yes | When the ticket was assigned last.
122
+ | due_date | DateTime | yes | When the ticket is due.
123
+ | solved | DateTime | yes | When the ticket was solved.
124
+ | created | DateTime | yes | When the ticket was created.
125
+ | updated | DateTime | yes | When the ticket was updated.
126
+
127
+ #### Example
128
+ ```js
129
+ {
130
+ "view": {
131
+ "id": 5,
132
+ "url": "https://example.zendesk.com/api/v2/views/5.json"
133
+ },
134
+ "rows": [
135
+ {
136
+ "ticket": { ... },
137
+ "locale": "en-US",
138
+ "group": { ... },
139
+ ...
140
+ },
141
+ ...
142
+ ],
143
+ "columns": [
144
+ {
145
+ "id": "locale",
146
+ "title": "Locale"
147
+ },
148
+ {
149
+ "id": 5,
150
+ "title": "Account",
151
+ "url": ...
152
+ },
153
+ ...
154
+ ]
155
+ }
156
+ ```
157
+
158
+ -->
159
+
160
+ ### List Views
161
+ `GET /api/v2/views.json`
162
+
163
+ Lists shared and personal Views available to the current user
164
+
165
+ #### Allowed For:
166
+
167
+ * Agents
168
+
169
+ #### Using curl
170
+
171
+ ```bash
172
+ curl https://{subdomain}.zendesk.com/api/v2/views.json \
173
+ -v -u {email_address}:{password}
174
+ ```
175
+
176
+ #### Example Response
177
+
178
+ ```http
179
+ Status: 200 OK
180
+
181
+ {
182
+ "views": [
183
+ {
184
+ "id":25,
185
+ "title":"Tickets updated <12 Hours",
186
+ "active":true,
187
+ "execution":{ ... },
188
+ "conditions": { ... },
189
+ "restriction":{ ... }
190
+ },
191
+ {
192
+ "id":23,
193
+ "title":"Unassigned tickets",
194
+ "active":false,
195
+ "execution":{ ... },
196
+ "conditions": { ... },
197
+ "restriction":{ ... }
198
+ },
199
+ ...
200
+ ],
201
+ "count": 7,
202
+ "next_page": null,
203
+ "previous_page": null
204
+ }
205
+ ```
206
+
207
+ ### List Active Views
208
+ `GET /api/v2/views/active.json`
209
+
210
+ Lists active shared and personal Views available to the current user
211
+
212
+ #### Allowed For:
213
+
214
+ * Agents
215
+
216
+ #### Using curl
217
+
218
+ ```bash
219
+ curl https://{subdomain}.zendesk.com/api/v2/views/active.json \
220
+ -v -u {email_address}:{password}
221
+ ```
222
+
223
+ #### Example Response
224
+
225
+ ```http
226
+ Status: 200 OK
227
+
228
+ {
229
+ "views": [
230
+ {
231
+ "id": 25,
232
+ "title": "Tickets updated <12 Hours",
233
+ "active": true
234
+ "execution": { ... },
235
+ "conditions": { ... },
236
+ "restriction": { ... }
237
+ },
238
+ ...
239
+ ],
240
+ "count": 7,
241
+ "next_page": null,
242
+ "previous_page": null
243
+ }
244
+ ```
245
+
246
+ ### List Views - Compact
247
+ `GET /api/v2/views/compact.json`
248
+
249
+ A compacted shared and personal Views available to the current user
250
+
251
+ #### Allowed For:
252
+
253
+ * Agents
254
+
255
+ #### Using curl
256
+
257
+ ```bash
258
+ curl https://{subdomain}.zendesk.com/api/v2/views/compact.json \
259
+ -v -u {email_address}:{password}
260
+ ```
261
+
262
+ #### Example Response
263
+
264
+ ```http
265
+ Status: 200 OK
266
+
267
+ {
268
+ "views": [
269
+ {
270
+ "id": 25,
271
+ "title": "Tickets updated <12 Hours",
272
+ "active": true
273
+ "execution": { ... },
274
+ "conditions": { ... },
275
+ "restriction": { ... }
276
+ },
277
+ ...
278
+ ],
279
+ "count": 7,
280
+ "next_page": null,
281
+ "previous_page": null
282
+ }
283
+ ```
284
+
285
+ ### Getting Views
286
+ `GET /api/v2/views/{id}.json`
287
+
288
+ #### Allowed For:
289
+
290
+ * Agents
291
+
292
+ #### Using curl
293
+
294
+ ```bash
295
+ curl https://{subdomain}.zendesk.com/api/v2/views/{id}.json \
296
+ -v -u {email_address}:{password}
297
+ ```
298
+
299
+ #### Example Response
300
+
301
+ ```http
302
+ Status: 200 OK
303
+
304
+ {
305
+ "view": {
306
+ "id": 25,
307
+ "title": "Tickets updated <12 Hours",
308
+ "active": true
309
+ "execution": { ... },
310
+ "conditions": { ... },
311
+ "restriction": { ... }
312
+ }
313
+ }
314
+ ```
315
+
316
+ ### Executing Views
317
+ `GET /api/v2/views/{id}/execute.json`
318
+
319
+ View output sorting can be controlled by passing the sort_by and sort_order parameters in the
320
+ format described in the table under [view previewing](#previewing-views).
321
+
322
+ #### Allowed For:
323
+
324
+ * Agents
325
+
326
+ #### Using curl
327
+
328
+ ```bash
329
+ curl https://{subdomain}.zendesk.com/api/v2/views/{id}/execute.json \
330
+ -v -u {email_address}:{password}
331
+ ```
332
+
333
+ With sort options:
334
+
335
+ ```bash
336
+ curl https://{subdomain}.zendesk.com/api/v2/views/{id}/execute.json?sort_by=id&sort_order=desc \
337
+ -v -u {email_address}:{password}
338
+ ```
339
+
340
+ #### Example Response
341
+
342
+ ```http
343
+ Status: 200 OK
344
+
345
+ {
346
+ "view": {
347
+ "id": 25,
348
+ "url": ...
349
+ },
350
+ "rows": [
351
+ {
352
+ "ticket": { ... },
353
+ "locale": "en-US",
354
+ "group": 1,
355
+ ...
356
+ },
357
+ ...
358
+ ],
359
+ "columns": [
360
+ {
361
+ "id": "locale",
362
+ "title": "Locale"
363
+ },
364
+ {
365
+ "id": 5,
366
+ "title": "Account",
367
+ "url": ...
368
+ },
369
+ ...
370
+ ],
371
+ "groups": [ ... ]
372
+ }
373
+ ```
374
+
375
+ ### Previewing Views
376
+ `POST /api/v2/views/preview.json`
377
+
378
+ Views can be previewed by constructing the conditions in the [proper format](#conditions) and nesting them under the 'view' key.
379
+ The output can also be controlled by passing in any of the following parameters and nesting them under the 'view' key.
380
+
381
+ | Name | Type | Comment
382
+ | --------------- | ------- | -------
383
+ | columns | Array | The ticket fields to display. System fields are looked up by name, custom fields by title or id.
384
+ | group_by | String | When present, the field by which the tickets are grouped
385
+ | group_order | String | The direction the tickets are grouped. May be one of 'asc' or 'desc'
386
+ | sort_order | String | The direction the tickets are sorted. May be one of 'asc' or 'desc'
387
+ | sort_by | String | The ticket field used for sorting. This will either be a title or a custom field id.
388
+
389
+ #### Allowed For:
390
+
391
+ * Agents
392
+
393
+ #### Using curl
394
+
395
+ ```bash
396
+ curl https://{subdomain}.zendesk.com/api/v2/views/preview.json \
397
+ -v -u {email_address}:{password} -X POST -H "Content-Type: application/json" \
398
+ -d '{"view": {"all": [{"operator": "is", "value": "open", "field": "status"}], "output": {"columns": ["subject"]}}}'
399
+ ```
400
+
401
+ #### Example Response
402
+
403
+ ```http
404
+ Status: 200 OK
405
+
406
+ {
407
+ "rows": [
408
+ {
409
+ "ticket": { ... },
410
+ "subject": "en-US",
411
+ ...
412
+ },
413
+ ...
414
+ ],
415
+ "columns": [
416
+ {
417
+ "id": "subject",
418
+ "title": "Subject"
419
+ },
420
+ ...
421
+ ]
422
+ }
423
+ ```
424
+
425
+ ### View Counts and Caching
426
+
427
+ The view count APIs allow an API consumer to estimate how many tickets remain in a View without having to retrieve the entire View.
428
+ These APIs are intended to help estimate View size; from a business perspective, accuracy becomes less relevant as your View size increases.
429
+ To ensure quality of service, these counts are cached more heavily as the number of tickets in a View grows. For a View with thousands of tickets,
430
+ you can expect its count to be cached for 60-90 minutes and may not reflect the actual number of tickets in your View.
431
+
432
+ ### View Counts
433
+ `GET /api/v2/views/count_many.json?ids={view_id},{view_id}`
434
+
435
+ Calculates the size of the view in terms of number of tickets the view will return.
436
+ Only returns values for personal and shared views accessible to the user performing
437
+ the request.
438
+
439
+ #### Allowed For:
440
+
441
+ * Agents
442
+
443
+ #### Using curl
444
+
445
+ ```bash
446
+ curl https://{subdomain}.zendesk.com/api/v2/views/count_many.json?ids={view_id} \
447
+ -v -u {email_address}:{password}
448
+ ```
449
+
450
+ #### Example Response
451
+
452
+ When you retrieve view counts that are not "fresh", it's recommended to wait for a short
453
+ while an poll again for only the stale view counts.
454
+
455
+ ```http
456
+ Status: 200 OK
457
+
458
+ {
459
+ "view_counts": [{
460
+ "view_id": 25,
461
+ "url": "https://company.zendesk.com/api/v2/rules/views/25/count.json",
462
+ "value": 719,
463
+ "pretty": "~700",
464
+ "fresh": true
465
+ },
466
+ {
467
+ "view_id": 78,
468
+ "url": "https://company.zendesk.com/api/v2/rules/views/78/count.json",
469
+ "value": null,
470
+ "pretty": "...",
471
+ "fresh": false
472
+ }
473
+ ]}
474
+ ```
475
+
476
+ ### View Count
477
+ `GET /api/v2/views/{id}/count.json`
478
+
479
+ Returns the ticket count for a single view.
480
+
481
+ #### Allowed For:
482
+
483
+ * Agents
484
+
485
+ #### Using curl
486
+
487
+ ```bash
488
+ curl https://{subdomain}.zendesk.com/api/v2/views/{id}/count.json \
489
+ -v -u {email_address}:{password}
490
+ ```
491
+
492
+ #### Example Response
493
+
494
+ ```http
495
+ Status: 200 OK
496
+ {
497
+ "view_count": {
498
+ "view_id": 25,
499
+ "url": "https://company.zendesk.com/api/v2/rules/views/25/count.json",
500
+ "value": 719,
501
+ "pretty": "~700",
502
+ "fresh": true
503
+ }
504
+ }
505
+ ```