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,125 @@
1
+ ## Ticket Metrics
2
+
3
+ ### JSON Format
4
+
5
+ | Name | Type | Read-only | Mandatory | Comment
6
+ | ---------------------------------- | ---------------------- | --------- | --------- | -------
7
+ | id | integer | yes | no | Automatically assigned
8
+ | ticket_id | integer | yes | no | Id of the associated ticket
9
+ | url | string | yes | no | The API url of this ticket metric
10
+ | group_stations | integer | yes | no | Number of groups this ticket passed through
11
+ | assignee_stations | integer | yes | no | Number of assignees this ticket had
12
+ | reopens | integer | yes | no | Total number of times the ticket was reopened
13
+ | replies | integer | yes | no | Total number of times ticket was replied to
14
+ | assignee_updated_at | date | yes | no | When the assignee last updated the ticket
15
+ | requester_updated_at | date | yes | no | When the requester last updated the ticket
16
+ | status_updated_at | date | yes | no | When the status was last updated
17
+ | initially_assigned_at | date | yes | no | When the ticket was initially assigned
18
+ | assigned_at | date | yes | no | When the ticket was last assigned
19
+ | solved_at | date | yes | no | When the ticket was solved
20
+ | latest_comment_added_at | date | yes | no | When the latest comment was added
21
+ | first_resolution_time_in_minutes | object | yes | no | Number of minutes to the first resolution time inside and out of business hours
22
+ | reply_time_in_minutes | object | yes | no | Number of minutes to the first reply inside and out of business hours
23
+ | full_resolution_time_in_minutes | object | yes | no | Number of minutes to the full resolution inside and out of business hours
24
+ | agent_wait_time_in_minutes | object | yes | no | Number of minutes the agent spent waiting inside and out of business hours
25
+ | requester_wait_time_in_minutes | object | yes | no | Number of minutes the requester spent waiting inside and out of business hours
26
+ | created_at | date | yes | no | When this record was created
27
+ | updated_at | date | yes | no | When this record last got updated
28
+
29
+ #### Example
30
+ ```js
31
+ { "id": 33,
32
+ "ticket_id": 4343,
33
+ "created_at": "2009-07-20T22:55:29Z",
34
+ "updated_at": "2011-05-05T10:38:52Z",
35
+ "group_stations": 7,
36
+ "assignee_stations": 1,
37
+ "reopens": 55,
38
+ "replies": 322,
39
+ "assignee_updated_at": "2011-05-06T10:38:52Z",
40
+ "requester_updated_at": "2011-05-07T10:38:52Z",
41
+ "status_updated_at": "2011-05-04T10:38:52Z",
42
+ "initially_assigned_at": "2011-05-03T10:38:52Z",
43
+ "assigned_at": "2011-05-05T10:38:52Z",
44
+ "solved_at": "2011-05-09T10:38:52Z",
45
+ "latest_comment_added_at": "2011-05-09T10:38:52Z",
46
+ "reply_time_in_minutes": { "calendar": 2391, "business": 737 },
47
+ "first_resolution_time_in_minutes": { "calendar": 2391, "business": 737 },
48
+ "full_resolution_time_in_minutes": { "calendar": 2391, "business": 737 },
49
+ "agent_wait_time_in_minutes": { "calendar": 2391, "business": 737 },
50
+ "requester_wait_time_in_minutes": { "calendar": 2391, "business": 737 },
51
+ "on_hold_time_in_minutes": { "calendar": 2290, "business": 637 }
52
+ }
53
+ ```
54
+
55
+ ### Listing Ticket Metrics
56
+ `GET /api/v2/ticket_metrics.json`
57
+
58
+ `GET /api/v2/tickets/{id}/metrics.json`
59
+
60
+ #### Allowed For
61
+
62
+ * Agents
63
+
64
+ #### Using curl
65
+
66
+ ```bash
67
+ curl https://{subdomain}.zendesk.com/api/v2/ticket_metrics.json \
68
+ -v -u {email_address}:{password}
69
+ ```
70
+
71
+ #### Example Response
72
+ ```http
73
+ Status: 200 OK
74
+
75
+ {
76
+ "ticket_metrics": [
77
+ {
78
+ "id": 33,
79
+ "ticket_id": 4343,
80
+ "reopens": 55,
81
+ "replies": 322,
82
+ ...
83
+ }
84
+ {
85
+ "id": 34,
86
+ "ticket_id": 443,
87
+ "reopens": 123,
88
+ "replies": 232,
89
+ ...
90
+ },
91
+ ]
92
+ }
93
+ ```
94
+
95
+ ### Getting Ticket Metrics
96
+ `GET /api/v2/ticket_metrics/{id}.json`
97
+
98
+ #### Allowed For
99
+
100
+ * Agents
101
+
102
+ #### Using curl:
103
+
104
+ ```bash
105
+ curl https://{subdomain}.zendesk.com/api/v2/ticket_metrics/{id}.json \
106
+ -v -u {email_address}:{password}
107
+ ```
108
+
109
+ #### Example Response
110
+
111
+ ```http
112
+ Status: 200 OK
113
+
114
+ {
115
+ "ticket_metric": {
116
+ {
117
+ "id": 34,
118
+ "ticket_id": 443,
119
+ "reopens": 123,
120
+ "replies": 232,
121
+ ...
122
+ }
123
+ }
124
+ }
125
+ ```
@@ -0,0 +1,622 @@
1
+ ## Tickets
2
+
3
+ Tickets are the means through which your End-users (customers) communicate with Agents in Zendesk. Tickets can originate via a number of support channels: email, web portal, chat, phone call, Twitter, Facebook and the API. All tickets have a core set of properties. Some key things to know are:
4
+
5
+ #### Requester
6
+
7
+ Every ticket has a Requester, Group and Assignee. The User who is asking for support through a ticket is the Requester. For most businesses that use Zendesk, the Requester is a customer, but Requesters can also be agents in your Zendesk.
8
+
9
+ #### Submitter
10
+
11
+ The Submitter is the User who created a ticket. If a Requester creates a ticket themselves, they are also the Submitter. If an agent creates a ticket through the web interface, the agent is set as the Submitter.
12
+
13
+ #### Collaborators
14
+
15
+ Aside from the Requester, a Ticket can include other people in its communication, known as Collaborators or CCs. Collaborators receive email notifications when tickets are updated. Collaborators can be either End-users or Agents.
16
+
17
+ #### Group
18
+
19
+ The Group that a Ticket is assigned to.
20
+
21
+ #### Assignee
22
+
23
+ The agent, within a Group, who is assigned to a Ticket. A Ticket can only be assigned to a single agent at a time.
24
+
25
+ #### Status
26
+
27
+ All tickets in Zendesk start out as New and progress through Open, Pending, Solved and Closed states. A Ticket must have an Assignee in order to be solved.
28
+
29
+ ### JSON Format
30
+ Tickets are represented as JSON objects which have the following keys:
31
+
32
+ | Name | Type | Read-only | Mandatory | Comment
33
+ | --------------------- | ---------------------------------------- | --------- | --------- | -------
34
+ | id | integer | yes | no | Automatically assigned when creating tickets
35
+ | url | string | yes | no | The API url of this ticket
36
+ | external_id | string | no | no | A unique external id, you can use this to link Zendesk tickets to local records
37
+ | type | string | no | no | The type of this ticket, i.e. "problem", "incident", "question" or "task"
38
+ | subject | string | no | no | The value of the subject field for this ticket
39
+ | description | string | yes | no | The first comment on the ticket
40
+ | priority | string | no | no | Priority, defines the urgency with which the ticket should be addressed: "urgent", "high", "normal", "low"
41
+ | status | string | no | no | The state of the ticket, "new", "open", "pending", "hold", "solved", "closed"
42
+ | recipient | string | yes | no | The original recipient e-mail address of the ticket
43
+ | requester_id | integer | no | yes | The user who requested this ticket
44
+ | submitter_id | integer | yes | no | The user who submitted the ticket; this is the currently authenticated API user
45
+ | assignee_id | integer | no | no | What agent is currently assigned to the ticket
46
+ | organization_id | integer | yes | no | The organization of the requester
47
+ | group_id | integer | no | no | The group this ticket is assigned to
48
+ | collaborator_ids | array | no | no | Who are currently CC'ed on the ticket
49
+ | forum_topic_id | integer | no | no | The topic this ticket originated from, if any
50
+ | problem_id | integer | no | no | The problem this incident is linked to, if any
51
+ | has_incidents | boolean | yes | no | Is true of this ticket has been marked as a problem, false otherwise
52
+ | due_at | date | no | no | If this is a ticket of type "task" it has a due date. Due date format uses [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) format.
53
+ | tags | array | no | no | The array of tags applied to this ticket
54
+ | via | [Via](ticket_audits.html#the-via-object) | yes | no | This object explains how the ticket was created
55
+ | custom_fields | array | no | no | The custom fields of the ticket
56
+ | satisfaction_rating | object | yes | no | The satisfaction rating of the ticket, if it exists
57
+ | sharing_agreement_ids | array | yes | no | The ids of the sharing agreements used for this ticket
58
+ | created_at | date | yes | no | When this record was created
59
+ | updated_at | date | yes | no | When this record last got updated
60
+
61
+ #### Example
62
+ ```js
63
+ {
64
+ "id": 35436,
65
+ "url": "https://company.zendesk.com/api/v2/tickets/35436.json",
66
+ "external_id": "ahg35h3jh",
67
+ "created_at": "2009-07-20T22:55:29Z",
68
+ "updated_at": "2011-05-05T10:38:52Z",
69
+ "type": "incident",
70
+ "subject": "Help, my printer is on fire!",
71
+ "description": "The fire is very colorful.",
72
+ "priority": "high",
73
+ "status": "open",
74
+ "recipient": "support@company.com",
75
+ "requester_id": 20978392,
76
+ "submitter_id": 76872,
77
+ "assignee_id": 235323,
78
+ "organization_id": 509974,
79
+ "group_id": 98738,
80
+ "collaborator_ids": [35334, 234],
81
+ "forum_topic_id": 72648221,
82
+ "problem_id": 9873764,
83
+ "has_incidents": false,
84
+ "due_at": null,
85
+ "tags": ["enterprise", "other_tag"],
86
+ "via": {
87
+ "channel": "web"
88
+ },
89
+ "custom_fields": [
90
+ {
91
+ "id": 27642,
92
+ "value": "745"
93
+ },
94
+ {
95
+ "id": 27648,
96
+ "value": "yes"
97
+ }
98
+ ],
99
+ "satisfaction_rating": {
100
+ "score": "good",
101
+ "comment": "Great support!"
102
+ },
103
+ "sharing_agreement_ids": [84432]
104
+ }
105
+ ```
106
+
107
+ ### Listing Tickets
108
+ `GET /api/v2/tickets.json`
109
+
110
+ Tickets are ordered chronologically by created date, from oldest to newest.
111
+
112
+ #### Allowed for
113
+
114
+ * Admins
115
+
116
+ `GET /api/v2/organizations/{organization_id}/tickets.json`
117
+
118
+ `GET /api/v2/views/{view_id}/tickets.json`
119
+
120
+ `GET /api/v2/users/{user_id}/tickets/requested.json`
121
+
122
+ `GET /api/v2/users/{user_id}/tickets/ccd.json`
123
+
124
+ `GET /api/v2/tickets/recent.json`
125
+
126
+ #### Allowed For
127
+
128
+ * Agents
129
+
130
+ #### Using curl
131
+
132
+ ```bash
133
+ curl https://{subdomain}.zendesk.com/api/v2/tickets.json \
134
+ -v -u {email_address}:{password}
135
+ ```
136
+
137
+ #### Example Response
138
+ ```http
139
+ Status: 200 OK
140
+
141
+ {
142
+ "tickets": [
143
+ {
144
+ "id": 35436,
145
+ "subject": "Help I need somebody!",
146
+ ...
147
+ },
148
+ {
149
+ "id": 20057623,
150
+ "subject": "Not just anybody!",
151
+ ...
152
+ },
153
+ ]
154
+ }
155
+ ```
156
+
157
+ ### Getting Tickets
158
+ `GET /api/v2/tickets/{id}.json`
159
+
160
+ #### Allowed For
161
+
162
+ * Agents
163
+
164
+ #### Using curl:
165
+
166
+ ```bash
167
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/{id}.json \
168
+ -v -u {email_address}:{password}
169
+ ```
170
+
171
+ #### Example Response
172
+
173
+ ```http
174
+ Status: 200 OK
175
+
176
+ {
177
+ "ticket": {
178
+ {
179
+ "id": 35436,
180
+ "subject": "My printer is on fire!",
181
+ ...
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ ### Show Multiple Tickets
188
+ `POST /api/v2/tickets/show_many?ids={ids}.json`
189
+
190
+ Accepts a comma separated list of ticket ids to return.
191
+
192
+ #### Allowed For:
193
+
194
+ * Agents
195
+
196
+ #### Using curl
197
+
198
+ ```bash
199
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/show_many.json?ids={id,id,id} \
200
+ -v -u {email_address}:{password} -X POST
201
+ ```
202
+
203
+ #### Example Response
204
+
205
+ See [Listing Tickets](#example-response)
206
+
207
+ ### Creating Tickets
208
+ `POST /api/v2/tickets.json`
209
+
210
+ #### Allowed For
211
+
212
+ * Agents
213
+
214
+ #### Using curl
215
+
216
+ ```bash
217
+ curl https://{subdomain}.zendesk.com/api/v2/tickets.json \
218
+ -d '{"ticket":{"subject":"My printer is on fire!", "comment": { "body": "The smoke is very colorful." }}}' \
219
+ -H "Content-Type: application/json" -v -u {email_address}:{password} -X POST
220
+ ```
221
+
222
+ #### Example Response
223
+
224
+ ```http
225
+ Status: 201 Created
226
+ Location: https://{subdomain}.zendesk.com/api/v2/tickets/{id}.json
227
+
228
+ {
229
+ "ticket": {
230
+ {
231
+ "id": 35436,
232
+ "subject": "My printer is on fire!",
233
+ ...
234
+ }
235
+ }
236
+ }
237
+ ```
238
+
239
+ ### Updating Tickets
240
+ `PUT /api/v2/tickets/{id}.json`
241
+
242
+ #### Allowed For
243
+
244
+ * Agents
245
+
246
+ #### Example Request
247
+
248
+ ```js
249
+ "ticket": {
250
+ "status": "solved"
251
+ }
252
+ ```
253
+
254
+ #### Using curl
255
+
256
+ ```bash
257
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/{id}.json \
258
+ -H "Content-Type: application/json" \
259
+ -d '{"ticket":{"status":"solved", \
260
+ "comment":{"public":true, "body": "Thanks, this is now solved!"}}}' \
261
+ -v -u {email_address}:{password} -X PUT
262
+ ```
263
+
264
+ #### Example Response
265
+
266
+ ```http
267
+ Status: 200 OK
268
+
269
+ {
270
+ "ticket": {
271
+ "id": 35436,
272
+ "subject": "My printer is on fire!",
273
+ "status": "solved",
274
+ ...
275
+ },
276
+ "audit": {
277
+ "events": [...],
278
+ ...
279
+ }
280
+ }
281
+ ```
282
+
283
+ ### Bulk Updating Tickets
284
+ `PUT /api/v2/tickets/update_many.json?ids={ids}`
285
+
286
+ #### Allowed For
287
+
288
+ * Agents
289
+
290
+ #### Example Request
291
+
292
+ ```js
293
+ "ticket": {
294
+ "status": "solved"
295
+ }
296
+ ```
297
+
298
+ #### Using curl
299
+
300
+ ```bash
301
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/update_many.json?ids=1,2,3 \
302
+ -H "Content-Type: application/json" -d "{\"ticket\":{\"status\":\"solved\"}}" \
303
+ -v -u {email_address}:{password} -X PUT
304
+ ```
305
+
306
+ #### Example Response
307
+
308
+ See [Job Status](job_statuses.md#show-job-status)
309
+
310
+ ### Setting Collaborators
311
+
312
+ You can set collaborators on tickets by passing in an array identifying the collaboratos you wish to
313
+ set. Each slot in the array is either the id of a user or the email address of a user or a hash containing
314
+ user name and email.
315
+
316
+ * `someone@example.com`
317
+ * `{ "name": "Someone Special", "email": "someone@example.com" }`
318
+
319
+ You can use the latter for also specifying the name of a collaborator such that the user gets created
320
+ on the fly with the appropriate name.
321
+
322
+ #### Example Request
323
+
324
+ ```js
325
+ "ticket": {
326
+ "collaborators": [ 562, "someone@example.com", { "name": "Someone Else", "email": "else@example.com" } ]
327
+ }
328
+ ```
329
+
330
+ Note that setting collaborators this way will completely ignore what's already set, so make sure to
331
+ include existing collaborators in the array if you wish to retain these on the ticket.
332
+
333
+ ### Setting Metadata
334
+
335
+ When you create or update a ticket, an [Audit](ticket_audits.md) gets generated if the ticket properties have changed.
336
+ On each such audit, you can add up to 1 kilobyte of custom metadata. You can use this to build your own integrations or apps.
337
+ **Note**: If your update does not change the ticket, this will not create an Audit and will not save your metadata.
338
+
339
+ #### Example Request
340
+
341
+ ```js
342
+ "ticket": {
343
+ "metadata": { "time_spent": "4m12s", "account": "integrations" },
344
+ "comment": { "body": "Please press play on tape now" },
345
+ "status": "pending"
346
+ }
347
+ ```
348
+
349
+ Note that metadata can only be set as part of other regular ticket updates as they are associated to a such
350
+ rather than just the ticket. Zendesk also adds metadata on each ticket update, and the resulting audit JSON
351
+ structure looks like this:
352
+
353
+ ```js
354
+ "audit": {
355
+ {
356
+ "id": 35436,
357
+ "ticket_id": 47,
358
+ "created_at": "2012-04-20T22:55:29Z",
359
+ "author_id": 35436,
360
+ "metadata": {
361
+ "custom": {
362
+ "time_spent": "4m12s",
363
+ "account": "integrations"
364
+ },
365
+ "system": {
366
+ "ip_address": "184.106.40.75",
367
+ "location": "United States",
368
+ "longitude": -97,
369
+ "latitude": 38,
370
+ "client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3)"
371
+ }
372
+ },
373
+ "via": {
374
+ "channel": "web"
375
+ },
376
+ "events": [
377
+ {
378
+ "id": 1564245,
379
+ "type": "Comment"
380
+ "body": "Please press play on tape now",
381
+ "public": true,
382
+ "attachments": []
383
+ },
384
+ ...
385
+ ]
386
+ }
387
+ }
388
+ ```
389
+
390
+ ### Attaching Files
391
+
392
+ When creating and updating tickets you may attach files by passing in
393
+ an array of the tokens received from uploading the files. For the upload attachment
394
+ to succeed when updating a ticket, a comment must be included.
395
+
396
+ To get the token of upload, see [Attachments](attachments.md) section on uploading files.
397
+
398
+ The upload tokens are single use only. After a token is used to attach a file to a ticket comment,
399
+ that token cannot be used to attach the same upload to an additional ticket comment.
400
+
401
+ #### Example Request
402
+
403
+ ```js
404
+ "ticket": {
405
+ "comment": { "body": "Please press play on tape now", "uploads": ["vz7ll9ud8oofowy"] }
406
+ }
407
+ ```
408
+
409
+ ### Creating a Ticket with a new Requester
410
+
411
+ Requesters can explicitly be created handling tickets.
412
+ The name, email, and locale id can be set on the new requester, with the name and email being required.
413
+
414
+ To get the locale id, see the [Locales](locales.md) section.
415
+
416
+ #### Example Request
417
+
418
+ ```js
419
+ "ticket": {
420
+ "subject": "Hello",
421
+ "comment": { "body": "Some question" },
422
+ "requester": { "locale_id": 8, "name": "Pablo", "email": "pablito@example.org" }
423
+ }
424
+ ```
425
+
426
+ Please note, if a user already exists with the given email address then we will use that user,
427
+ no updates will be made to existing users during the ticket create process. In this approach, only the email attribute is required.
428
+
429
+ ### Setting Ticket Fields
430
+
431
+ When creating or updating a ticket, [Ticket Fields](ticket_fields.md) can be set by passing in
432
+ an array of objects in the format { id: {id}, value: {value} }.
433
+
434
+ #### Example Request
435
+
436
+ ```js
437
+ "ticket": {
438
+ "subject": "Hello",
439
+ "comment": { "body": "Some question" },
440
+ "custom_fields": [{ "id": 34, "value": "I need help!" }]
441
+ }
442
+ ```
443
+
444
+ ### Deleting Tickets
445
+ `DELETE /api/v2/tickets/{id}.json`
446
+
447
+ #### Allowed For
448
+
449
+ * Admins
450
+
451
+ #### Using curl
452
+
453
+ ```bash
454
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/{id}.json \
455
+ -v -u {email_address}:{password} -X DELETE
456
+ ```
457
+
458
+ #### Example Response
459
+
460
+ ```http
461
+ Status: 200 OK
462
+ ```
463
+
464
+ ### Bulk Deleting Tickets
465
+ `DELETE /api/v2/tickets/destroy_many.json?ids={ids}`
466
+
467
+ #### Allowed For
468
+
469
+ * Agents
470
+
471
+ #### Using curl
472
+
473
+ ```bash
474
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/destroy_many.json?ids=1,2,3 \
475
+ -v -u {email_address}:{password} -X DELETE
476
+ ```
477
+
478
+ #### Example Response
479
+
480
+ ```http
481
+ Status: 200 OK
482
+ ```
483
+
484
+ ### List Collaborators for a Ticket
485
+ `GET /api/v2/tickets/{id}/collaborators.json`
486
+
487
+ #### Allowed For
488
+
489
+ * Agents
490
+
491
+ #### Using curl
492
+
493
+ ```bash
494
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/{id}/collaborators.json \
495
+ -v -u {email_address}:{password}
496
+ ```
497
+
498
+ #### Example Response
499
+
500
+ ```http
501
+ Status: 200
502
+
503
+ {
504
+ "users": [
505
+ {
506
+ "id": 223443,
507
+ "name": "Johnny Agent",
508
+ ...
509
+ },
510
+ {
511
+ "id": 8678530,
512
+ "name": "Peter Admin",
513
+ ...
514
+ }
515
+ ]
516
+ }
517
+ ```
518
+
519
+ ### Listing Ticket Incidents
520
+ `GET /api/v2/tickets/{id}/incidents.json`
521
+
522
+ #### Allowed For
523
+
524
+ * Agents
525
+
526
+ #### Using curl
527
+
528
+ ```bash
529
+ curl https://{subdomain}.zendesk.com/api/v2/tickets/12345/incidents.json \
530
+ -v -u {email_address}:{password}
531
+ ```
532
+
533
+ #### Example Response
534
+ ```http
535
+ Status: 200 OK
536
+
537
+ {
538
+ "tickets": [
539
+ {
540
+ "id": 33,
541
+ "subject": "My printer is on fire",
542
+ "description": "The fire is very colorful.",
543
+ "status": "open",
544
+ ...
545
+ },
546
+ {
547
+ "id": 34,
548
+ "subject": "The printer is on fire over here too",
549
+ "description": "The fire is very colorful as well!",
550
+ "status": "pending",
551
+ ...
552
+ },
553
+ ]
554
+ }
555
+ ```
556
+
557
+ ### Listing Ticket Problems
558
+ `GET /api/v2/problems.json`
559
+
560
+ #### Allowed For
561
+
562
+ * Agents
563
+
564
+ #### Using curl
565
+
566
+ ```bash
567
+ curl https://{subdomain}.zendesk.com/api/v2/problems.json \
568
+ -v -u {email_address}:{password}
569
+ ```
570
+
571
+ #### Example Response
572
+
573
+ ```http
574
+ Status: 200 OK
575
+
576
+ {
577
+ "tickets": [
578
+ {
579
+ "id": 33,
580
+ "subject": "My printer is on fire",
581
+ "description": "The fire is very colorful.",
582
+ "status": "open",
583
+ ...
584
+ },
585
+ {
586
+ "id": 34,
587
+ "subject": "The printer is on fire over here too",
588
+ "description": "The fire is very colorful as well!",
589
+ "status": "pending",
590
+ ...
591
+ },
592
+ ]
593
+ }
594
+ ```
595
+
596
+ ### Autocomplete Problems
597
+ `POST /api/v2/problems/autocomplete.json?text={name}`
598
+
599
+ #### Allowed For
600
+
601
+ * Agents
602
+
603
+ #### Using curl
604
+
605
+ ```bash
606
+ curl https://{subdomain}.zendesk.com/api/v2/problems/autocomplete.json \
607
+ -X POST -d '{"text": "att"}' -H "Content-Type: application/json" \
608
+ -u {email_address}:{password}
609
+ ```
610
+
611
+ #### Example Response
612
+
613
+ ```http
614
+ Status: 200 OK
615
+
616
+ {
617
+ "tickets": [
618
+ { .. ticket record as in the #index method .. },
619
+ { .. ticket record as in the #index method .. }
620
+ ]
621
+ }
622
+ ```