zendesk_api 0.2.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Gemfile +7 -0
- data/Gemfile.lock +10 -2
- data/LICENSE +176 -19
- data/Readme.md +13 -5
- data/config/newrelic.yml +255 -0
- data/lib/zendesk_api/association.rb +1 -1
- data/lib/zendesk_api/associations.rb +129 -100
- data/lib/zendesk_api/client.rb +44 -25
- data/lib/zendesk_api/collection.rb +83 -58
- data/lib/zendesk_api/console/extensions.rb +47 -28
- data/lib/zendesk_api/server/base.rb +4 -0
- data/lib/zendesk_api/server/docs/account_settings.md +8 -0
- data/lib/zendesk_api/server/docs/automations.md +6 -0
- data/lib/zendesk_api/server/docs/changes_roadmap.md +76 -1
- data/lib/zendesk_api/server/docs/forum_subscriptions.md +2 -2
- data/lib/zendesk_api/server/docs/introduction.md +4 -2
- data/lib/zendesk_api/server/docs/macros.md +2 -0
- data/lib/zendesk_api/server/docs/organizations.md +3 -4
- data/lib/zendesk_api/server/docs/requests.md +21 -7
- data/lib/zendesk_api/server/docs/tickets.md +64 -8
- data/lib/zendesk_api/server/docs/topic_subscriptions.md +3 -3
- data/lib/zendesk_api/server/docs/topic_votes.md +0 -1
- data/lib/zendesk_api/server/docs/triggers.md +7 -0
- data/lib/zendesk_api/server/docs/users.md +4 -4
- data/lib/zendesk_api/server/docs/views.md +57 -8
- data/lib/zendesk_api/server/public/doc/ZendeskAPI.html +131 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ability.html +190 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Activity.html +616 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Attachment.html +362 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Automation.html +438 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Bookmark.html +243 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CRMData.html +190 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CRMDataStatus.html +190 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Category.html +462 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Client.html +1490 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Collection.html +2825 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Configuration.html +1212 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Console.html +860 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Console/Eval.html +190 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Create.html +134 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Create/ClassMethods.html +322 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CreateResource.html +222 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CustomRole.html +190 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Data.html +1432 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/DataResource.html +348 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/DeleteResource.html +216 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Destroy.html +307 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Destroy/ClassMethod.html +245 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/FormatError.html +123 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Forum.html +1196 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ForumSubscription.html +616 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Group.html +243 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/GroupMembership.html +616 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/JobStatus.html +209 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Locale.html +209 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Macro.html +438 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/MobileDevice.html +361 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Organization.html +1016 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Read.html +278 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ReadResource.html +220 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Request.html +826 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Request/Comment.html +604 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Resource.html +258 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Role.html +190 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/RuleExecution.html +383 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SatisfactionRating.html +938 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Save.html +510 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Search.html +403 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Search/Result.html +166 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server.html +131 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/App.html +523 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/Helper.html +684 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/HtmlRenderer.html +303 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/HtmlRenderer/RedcarpetRenderer.html +508 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/UserRequest.html +125 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/ZlibJSON.html +244 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Setting.html +350 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SharingAgreement.html +209 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SingularResource.html +247 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SuspendedTicket.html +342 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket.html +2731 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Audit.html +385 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Comment.html +636 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Tag.html +243 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TicketField.html +243 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TicketMetric.html +205 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic.html +1086 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic/TopicComment.html +232 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic/TopicVote.html +624 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TopicComment.html +743 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TopicSubscription.html +616 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Trigger.html +438 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Update.html +140 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Update/ClassMethod.html +237 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/UpdateResource.html +222 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Upload.html +404 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/User.html +3611 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/User/Identity.html +563 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/User/TopicComment.html +194 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Verbs.html +338 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/View.html +1283 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ViewCount.html +190 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ViewRow.html +1342 -0
- data/lib/zendesk_api/server/public/doc/_index.html +799 -0
- data/lib/zendesk_api/server/public/doc/class_list.html +53 -0
- data/lib/zendesk_api/server/public/doc/css/common.css +1 -0
- data/lib/zendesk_api/server/public/doc/css/full_list.css +57 -0
- data/lib/zendesk_api/server/public/doc/css/style.css +328 -0
- data/lib/zendesk_api/server/public/doc/file.Readme.html +377 -0
- data/lib/zendesk_api/server/public/doc/file_list.html +55 -0
- data/lib/zendesk_api/server/public/doc/frames.html +28 -0
- data/lib/zendesk_api/server/public/doc/index.html +377 -0
- data/lib/zendesk_api/server/public/doc/js/app.js +214 -0
- data/lib/zendesk_api/server/public/doc/js/full_list.js +173 -0
- data/lib/zendesk_api/server/public/doc/js/jquery.js +4 -0
- data/lib/zendesk_api/server/public/doc/method_list.html +2540 -0
- data/lib/zendesk_api/server/public/doc/top-level-namespace.html +144 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/zendesk_api.gemspec +1 -1
- metadata +96 -3
@@ -1,6 +1,10 @@
|
|
1
1
|
class ZendeskAPI::FormatError < ArgumentError; end
|
2
2
|
|
3
|
-
|
3
|
+
module Console
|
4
|
+
def self.included(klass)
|
5
|
+
klass.instance_eval { alias :orig_log_error :log_error }
|
6
|
+
end
|
7
|
+
|
4
8
|
def /(id)
|
5
9
|
if id == ZendeskAPI::Console::ZD_DIRUP
|
6
10
|
if @collection_path.length == 1
|
@@ -20,8 +24,6 @@ class ZendeskAPI::Collection
|
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
23
|
-
alias :orig_log_error :log_error
|
24
|
-
|
25
27
|
def log_error(e, _)
|
26
28
|
raise e
|
27
29
|
end
|
@@ -39,7 +41,13 @@ class ZendeskAPI::Collection
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
|
44
|
+
ZendeskAPI::Collection.send(:include, Console)
|
45
|
+
|
46
|
+
module Subclasses
|
47
|
+
def self.included(klass)
|
48
|
+
klass.extend ClassMethods
|
49
|
+
end
|
50
|
+
|
43
51
|
GET_SUBCLASSES = lambda do |ary|
|
44
52
|
ary.map! do |klass|
|
45
53
|
if klass.name =~ /Resource$/
|
@@ -56,16 +64,6 @@ class ZendeskAPI::Client
|
|
56
64
|
"/"
|
57
65
|
end
|
58
66
|
|
59
|
-
def self.resources
|
60
|
-
@resources ||= begin
|
61
|
-
subclasses = GET_SUBCLASSES.call(ZendeskAPI::Data.subclasses)
|
62
|
-
subclasses.delete_if do |resource|
|
63
|
-
resource.name =~ /ZendeskAPI(::.*){2,}/
|
64
|
-
end
|
65
|
-
subclasses.sort_by(&:resource_name)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
67
|
def to_a
|
70
68
|
self.class.resources
|
71
69
|
end
|
@@ -73,9 +71,23 @@ class ZendeskAPI::Client
|
|
73
71
|
def format_headers
|
74
72
|
["resource name"]
|
75
73
|
end
|
74
|
+
|
75
|
+
module ClassMethods
|
76
|
+
def resources
|
77
|
+
@resources ||= begin
|
78
|
+
subclasses = GET_SUBCLASSES.call(ZendeskAPI::Data.subclasses)
|
79
|
+
subclasses.delete_if do |resource|
|
80
|
+
resource.name =~ /ZendeskAPI(::.*){2,}/
|
81
|
+
end
|
82
|
+
subclasses.sort_by(&:resource_name)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
76
86
|
end
|
77
87
|
|
78
|
-
|
88
|
+
ZendeskAPI::Client.send(:include, Subclasses)
|
89
|
+
|
90
|
+
module Path
|
79
91
|
def /(method)
|
80
92
|
if method == ZendeskAPI::Console::ZD_DIRUP
|
81
93
|
if association.options.parent
|
@@ -89,27 +101,34 @@ class ZendeskAPI::Data
|
|
89
101
|
send(method)
|
90
102
|
end
|
91
103
|
end
|
104
|
+
end
|
92
105
|
|
93
|
-
|
94
|
-
|
106
|
+
module Format
|
107
|
+
def self.extended(klass)
|
108
|
+
class << klass
|
109
|
+
attr_accessor :format_headers
|
110
|
+
end
|
111
|
+
end
|
95
112
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end
|
113
|
+
def format(client = nil, &block)
|
114
|
+
if block_given?
|
115
|
+
class_eval do
|
116
|
+
define_method :format do
|
117
|
+
instance_eval &block
|
102
118
|
end
|
103
|
-
elsif client && client.send(resource_name).loaded?
|
104
|
-
["@#{resource_name}"]
|
105
|
-
else
|
106
|
-
[resource_name]
|
107
119
|
end
|
120
|
+
elsif client && client.send(resource_name).loaded?
|
121
|
+
["@#{resource_name}"]
|
122
|
+
else
|
123
|
+
[resource_name]
|
108
124
|
end
|
109
125
|
end
|
110
126
|
end
|
111
127
|
|
112
|
-
|
128
|
+
ZendeskAPI::Data.send(:include, Path)
|
129
|
+
ZendeskAPI::Data.extend Format
|
130
|
+
|
131
|
+
ZendeskAPI::DataResource.instance_eval do
|
113
132
|
format_headers = %w{id created_at}
|
114
133
|
|
115
134
|
format do
|
@@ -76,6 +76,11 @@ Account Settings are read-only. They contain settings for the various aspects of
|
|
76
76
|
| ---------------------------------- | ------- | -------
|
77
77
|
| enabled | boolean | GoodData Advanced Analytics is enabled
|
78
78
|
|
79
|
+
### Billing
|
80
|
+
|
81
|
+
| Name | Type | Comment
|
82
|
+
| ---------------------------------- | ------- | -------
|
83
|
+
| backend | string | Backend Billing system either 'internal' or 'zuora'
|
79
84
|
|
80
85
|
#### Example
|
81
86
|
|
@@ -119,6 +124,9 @@ Account Settings are read-only. They contain settings for the various aspects of
|
|
119
124
|
"users": {
|
120
125
|
"tagging":true
|
121
126
|
}
|
127
|
+
"billing" :{
|
128
|
+
"backend": 'internal'
|
129
|
+
}
|
122
130
|
}
|
123
131
|
```
|
124
132
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
## Automations
|
2
2
|
|
3
|
+
An automation consists of one or more actions that are performed if certain conditions are met after a period of time. The conditions are checked every hour. For example, an automation can notify an agent when a ticket remains unresolved after 24 hours.
|
4
|
+
|
5
|
+
Even if the actions are performed once, they'll be performed again later if the conditions still apply. To ensure the actions are performed only once, include an action in the automation that cancels one of the conditions.
|
6
|
+
|
7
|
+
For more information, see [Streamlining workflow with time-based events and automations](https://support.zendesk.com/entries/20012032).
|
8
|
+
|
3
9
|
### JSON Format
|
4
10
|
Automations are represented as simple flat JSON objects which have the following keys.
|
5
11
|
|
@@ -161,7 +161,7 @@ Furthermore, we have consolidated the grouping and sorting definitions of each V
|
|
161
161
|
{
|
162
162
|
"id": 336767,
|
163
163
|
"title": "About"
|
164
|
-
|
164
|
+
}
|
165
165
|
]
|
166
166
|
}
|
167
167
|
...
|
@@ -208,4 +208,79 @@ will be changed to
|
|
208
208
|
...
|
209
209
|
}
|
210
210
|
}
|
211
|
+
```
|
212
|
+
|
213
|
+
### April 24, 2013
|
214
|
+
|
215
|
+
The following changes will go into effect on April 24, 2013:
|
216
|
+
|
217
|
+
#### Moving miscellaneous side-loads into the resource itself
|
218
|
+
|
219
|
+
##### Affected endpoints
|
220
|
+
|
221
|
+
* ``GET /api/v2/tickets.json``
|
222
|
+
* ``GET /api/v2/tickets/{id}.json``
|
223
|
+
* ``GET /api/v2/organizations.json``
|
224
|
+
* ``GET /api/v2/organizations/{id}.json``
|
225
|
+
* ``GET /api/v2/users.json``
|
226
|
+
* ``GET /api/v2/users/{id}.json``
|
227
|
+
|
228
|
+
##### Deprecation
|
229
|
+
|
230
|
+
On January 28, 2012, in the above endpoints, the following side-loaded resources were added
|
231
|
+
to the actual model and the root-level side-load was deprecated.
|
232
|
+
|
233
|
+
Tickets: last_audits, metric_sets
|
234
|
+
Organizations: abilities
|
235
|
+
Users: abilities
|
236
|
+
|
237
|
+
##### What's changing
|
238
|
+
|
239
|
+
To improve consistencies in our API, we are moving some side-loads that are unbounded and never
|
240
|
+
duplicated into the actual model instead of at the root level.
|
241
|
+
|
242
|
+
##### Example
|
243
|
+
|
244
|
+
```
|
245
|
+
GET /api/v2/users.json?include=abilities
|
246
|
+
|
247
|
+
{
|
248
|
+
"users": [{
|
249
|
+
"id": 1,
|
250
|
+
...
|
251
|
+
},
|
252
|
+
{
|
253
|
+
"id": 2,
|
254
|
+
...
|
255
|
+
}],
|
256
|
+
"abilities": [{
|
257
|
+
"user_id": 1,
|
258
|
+
...
|
259
|
+
},
|
260
|
+
{
|
261
|
+
"user_id": 2,
|
262
|
+
...
|
263
|
+
}]
|
264
|
+
}
|
265
|
+
```
|
266
|
+
|
267
|
+
will now return
|
268
|
+
|
269
|
+
```
|
270
|
+
{
|
271
|
+
"users": [{
|
272
|
+
"id": 1,
|
273
|
+
"abilities": {
|
274
|
+
"user_id": 1,
|
275
|
+
...
|
276
|
+
}
|
277
|
+
},
|
278
|
+
{
|
279
|
+
"id": 2,
|
280
|
+
"abilities": {
|
281
|
+
"user_id": 2,
|
282
|
+
...
|
283
|
+
}
|
284
|
+
}]
|
285
|
+
}
|
211
286
|
```
|
@@ -99,8 +99,8 @@ Status: 200 OK
|
|
99
99
|
|
100
100
|
```bash
|
101
101
|
curl https://{subdomain}.zendesk.com/api/v2/forum_subscriptions.json \
|
102
|
-
-d '{"user_id": 772, "forum_id": 881}' \
|
103
|
-
-v -u {email_address}:{password} -X POST
|
102
|
+
-d '{"forum_subscription": {"user_id": 772, "forum_id": 881}}' \
|
103
|
+
-v -u {email_address}:{password} -H "Content-Type: application/json" -X POST
|
104
104
|
```
|
105
105
|
|
106
106
|
#### Example Response
|
@@ -13,7 +13,7 @@ We reserves the right to add new attributes and resources to the API without adv
|
|
13
13
|
|
14
14
|
### Security and Authentication
|
15
15
|
|
16
|
-
This API is an SSL-only API, regardless of how you may have your account configured. You can authorize against the API using either basic authentication with your username and password credentials or
|
16
|
+
This API is an SSL-only API, regardless of how you may have your account configured. You can authorize against the API using either basic authentication with your username and password credentials, or with a username and API token. This token is configurable in your Zendesk account under **Settings** > **Channels** > **API**.
|
17
17
|
|
18
18
|
### Rate Limiting
|
19
19
|
|
@@ -84,7 +84,7 @@ Collections return a maximum of 100 records per page, and by default return 100
|
|
84
84
|
"users": [ ... ],
|
85
85
|
"count": 1234,
|
86
86
|
"next_page": "https://account.zendesk.com/api/v2/users.json?page=2",
|
87
|
-
"
|
87
|
+
"previous_page": null
|
88
88
|
}
|
89
89
|
```
|
90
90
|
|
@@ -140,6 +140,7 @@ The response receieved will then include a top-level array of associated data un
|
|
140
140
|
| [Tickets](tickets.html) | users, groups, organizations, last_audits, metric_sets, sharing_agreements
|
141
141
|
| [Audits](audits.html) | users, organizations, groups, tickets
|
142
142
|
| [Users](users.html) | organizations, abilities, roles, identities, groups
|
143
|
+
| [Groups](groups.html) | users
|
143
144
|
| [Group Memberships](group_memberships.html) | users, groups
|
144
145
|
| [Organizations](organizations.html) | abilities
|
145
146
|
| [View Execution / Previewing](views.html#executing-views) | The following are automatically side-loaded if applicable: group, organization, users
|
@@ -156,6 +157,7 @@ The response receieved will then include a top-level array of associated data un
|
|
156
157
|
|
157
158
|
### API Clients from the Zendesk Developer Community
|
158
159
|
|
160
|
+
* [Python Client Library by Eventbrite](https://github.com/eventbrite/zendesk)
|
159
161
|
* [.NET Client Library by Eric Neifert](https://github.com/eneifert/ZendeskApi_v2)
|
160
162
|
* [zendeskR by Basho Technologies (R)](https://github.com/tcash21/zendeskR)
|
161
163
|
* [node-zendesk by Farrin Reid (node.js)](https://github.com/blakmatrix/node-zendesk)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
## Macros
|
2
2
|
|
3
|
+
A macro consists of one or more actions that modify the values of a ticket's fields. Macros are applied to tickets manually by agents. For example, you can create macros for support requests that agents can answer with a single, standard response. For more information, see [Using macros to update and add comments to tickets](https://support.zendesk.com/entries/20011363).
|
4
|
+
|
3
5
|
### JSON Format
|
4
6
|
Macros are represented as simple flat JSON objects which have the following keys.
|
5
7
|
|
@@ -180,14 +180,13 @@ Location: https://{subdomain}.zendesk.com/api/v2/organizations/{id}.json
|
|
180
180
|
|
181
181
|
#### Allowed For
|
182
182
|
|
183
|
-
*
|
183
|
+
* Agents, restrictions apply on certain actions
|
184
184
|
|
185
185
|
#### Using curl
|
186
186
|
|
187
187
|
```bash
|
188
|
-
curl https://{subdomain}.zendesk.com/api/v2/organizations/create_many.json \
|
189
|
-
-H "Content-Type: application/json" -X POST -d
|
190
|
-
-v -u {email_address}:{password}
|
188
|
+
curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/organizations/create_many.json \
|
189
|
+
-H "Content-Type: application/json" -X POST -d '{"organizations": [{"name": "Org1"}, {"name": "Org2"}]}'
|
191
190
|
```
|
192
191
|
|
193
192
|
#### Example Response
|
@@ -1,6 +1,20 @@
|
|
1
1
|
## Requests
|
2
2
|
|
3
|
-
A
|
3
|
+
A _request_ is an end-user's perspective on a ticket. End-users can only see public comments and certain fields of a ticket. Use this API to let end-users view, update, and create tickets they have access to.
|
4
|
+
|
5
|
+
####Authentication
|
6
|
+
|
7
|
+
You must use the following authentication credentials with this API:
|
8
|
+
* Use the end-user's email address, _not_ an agent's email address as is the case with all other API end-points.
|
9
|
+
* Use your API token as the password, and append `/token` to the email address.
|
10
|
+
|
11
|
+
To get your API token, go to Manage > Channels in Zendesk, and then click the Edit link in the API channel.
|
12
|
+
|
13
|
+
__Example__
|
14
|
+
|
15
|
+
```js
|
16
|
+
-u joe_enduser@zendesk.com/token:{YOUR_API_TOKEN}
|
17
|
+
```
|
4
18
|
|
5
19
|
### JSON Format
|
6
20
|
Requests are represented as JSON objects which have the following keys:
|
@@ -89,7 +103,7 @@ Ticket comments have the following keys:
|
|
89
103
|
|
90
104
|
```bash
|
91
105
|
curl https://{subdomain}.zendesk.com/api/v2/requests.json \
|
92
|
-
-v -u {email_address}:{
|
106
|
+
-v -u {email_address}/token:{api_token}
|
93
107
|
```
|
94
108
|
|
95
109
|
#### Example Response
|
@@ -125,7 +139,7 @@ Status: 200 OK
|
|
125
139
|
|
126
140
|
```bash
|
127
141
|
curl https://{subdomain}.zendesk.com/api/v2/requests/{id}.json \
|
128
|
-
-v -u {email_address}:{
|
142
|
+
-v -u {email_address}/token:{api_token}
|
129
143
|
```
|
130
144
|
|
131
145
|
#### Example Response
|
@@ -154,7 +168,7 @@ Status: 200 OK
|
|
154
168
|
```bash
|
155
169
|
curl https://{subdomain}.zendesk.com/api/v2/requests.json \
|
156
170
|
-d '{"request": {"subject": "Help!", "comment": {"body": "My printer is on fire!", "uploads": [...]}}}' \
|
157
|
-
-v -u {email_address}:{
|
171
|
+
-v -u {email_address}/token:{api_token} -X POST -H "Content-Type: application/json"
|
158
172
|
```
|
159
173
|
|
160
174
|
#### Example Response
|
@@ -185,7 +199,7 @@ Location: https://{subdomain}.zendesk.com/api/v2/requests/{id}.json
|
|
185
199
|
```bash
|
186
200
|
curl https://{subdomain}.zendesk.com/api/v2/requests/{id}.json \
|
187
201
|
-d '{"request": {"comment": {"body": "Thanks!"}}}' \
|
188
|
-
-v -u {email_address}:{
|
202
|
+
-v -u {email_address}/token:{api_token} -X PUT -H "Content-Type: application/json"
|
189
203
|
```
|
190
204
|
|
191
205
|
#### Example Response
|
@@ -213,7 +227,7 @@ Status: 200 OK
|
|
213
227
|
|
214
228
|
```bash
|
215
229
|
curl https://{subdomain}.zendesk.com/api/v2/requests/{id}/comments.json \
|
216
|
-
-v -u {email_address}:{
|
230
|
+
-v -u {email_address}/token:{api_token}
|
217
231
|
```
|
218
232
|
|
219
233
|
#### Example Response
|
@@ -243,7 +257,7 @@ Status: 200 OK
|
|
243
257
|
|
244
258
|
```bash
|
245
259
|
curl https://{subdomain}.zendesk.com/api/v2/requests/{request_id}/comments/{id}.json \
|
246
|
-
-v -u {email_address}:{
|
260
|
+
-v -u {email_address}/token:{api_token}
|
247
261
|
```
|
248
262
|
|
249
263
|
#### Example Response
|
@@ -234,6 +234,39 @@ Location: https://{subdomain}.zendesk.com/api/v2/tickets/{id}.json
|
|
234
234
|
}
|
235
235
|
```
|
236
236
|
|
237
|
+
#### Request parameters
|
238
|
+
|
239
|
+
The POST request takes one parameter, a `ticket` object that lists the values to set when the ticket is created.
|
240
|
+
|
241
|
+
| Name | Description |
|
242
|
+
| -------- | ---------------------------------------------------- |
|
243
|
+
| subject | Required. The subject of the ticket. |
|
244
|
+
| comment | Required. A comment object that describes the problem, incident, question, or task. See [Ticket comments](http://developer.zendesk.com/documentation/rest_api/ticket_audits.html#audit-events) in Audit Events. |
|
245
|
+
| requester\_id | The numeric ID of the user asking for support through the ticket. |
|
246
|
+
| submitter\_id | The numeric ID of the user submitting the ticket. |
|
247
|
+
| assignee\_id | The numeric ID of the agent to assign the ticket to. |
|
248
|
+
| group\_id | The numeric ID of the group to assign the ticket to. |
|
249
|
+
| collaborator\_ids | An array of the numeric IDs of agents or end-users to CC on the ticket. An email notification is sent to them when the ticket is created. |
|
250
|
+
| type | Allowed values are `problem`, `incident`, `question`, or `task`. |
|
251
|
+
| priority | Allowed values are `urgent`, `high`, `normal`, or `low`. |
|
252
|
+
| status | Allowed values are `new`, `open`, `pending`, `hold`, `solved` or `closed`. Is set to `open` if status is not specified. |
|
253
|
+
| tags | An array of tags to add to the ticket. |
|
254
|
+
| external\_id | A unique external ID to link Zendesk tickets to local records. |
|
255
|
+
| forum\_topic\_id | The numeric ID of the topic the ticket originated from, if any. |
|
256
|
+
| problem\_id | For tickets of type "incident", the numeric ID of the problem the incident is linked to, if any. |
|
257
|
+
| due\_at | For tickets of type "task", the due date of the task. Accepts the ISO 8601 date format (yyyy-mm-dd). |
|
258
|
+
| custom\_fields | An array of the custom fields of the ticket. |
|
259
|
+
|
260
|
+
#### Example request
|
261
|
+
|
262
|
+
```js
|
263
|
+
"ticket":{
|
264
|
+
"subject":"My printer is on fire!",
|
265
|
+
"comment": { "body": "The smoke is very colorful." },
|
266
|
+
"priority": "urgent"
|
267
|
+
}
|
268
|
+
```
|
269
|
+
|
237
270
|
### Updating Tickets
|
238
271
|
`PUT /api/v2/tickets/{id}.json`
|
239
272
|
|
@@ -241,14 +274,6 @@ Location: https://{subdomain}.zendesk.com/api/v2/tickets/{id}.json
|
|
241
274
|
|
242
275
|
* Agents
|
243
276
|
|
244
|
-
#### Example Request
|
245
|
-
|
246
|
-
```js
|
247
|
-
"ticket": {
|
248
|
-
"status": "solved"
|
249
|
-
}
|
250
|
-
```
|
251
|
-
|
252
277
|
#### Using curl
|
253
278
|
|
254
279
|
```bash
|
@@ -278,6 +303,37 @@ Status: 200 OK
|
|
278
303
|
}
|
279
304
|
```
|
280
305
|
|
306
|
+
#### Request parameters
|
307
|
+
|
308
|
+
The PUT request takes one parameter, a `ticket` object that lists the values to update. All properties are optional.
|
309
|
+
|
310
|
+
| Name | Description |
|
311
|
+
| -------- | ---------------------------------------------------- |
|
312
|
+
| subject | The subject of the ticket. |
|
313
|
+
| comment | An object that adds a comment to the ticket. See [Ticket comments](http://developer.zendesk.com/documentation/rest_api/ticket_audits.html#audit-events) in Audit Events. |
|
314
|
+
| requester\_id | The numeric ID of the user asking for support through the ticket. |
|
315
|
+
| assignee\_id | The numeric ID of the agent to assign the ticket to. |
|
316
|
+
| group\_id | The numeric ID of the group to assign the ticket to. |
|
317
|
+
| collaborator\_ids | An array of the numeric IDs of agents or end-users to CC. Note that this replaces any existing collaborators. An email notification is sent to them when the ticket is created. |
|
318
|
+
| type | Allowed values are `problem`, `incident`, `question`, or `task`. |
|
319
|
+
| priority | Allowed values are `urgent`, `high`, `normal`, or `low`. |
|
320
|
+
| status | Allowed values are `open`, `pending`, `hold`, `solved` or `closed`. |
|
321
|
+
| tags | An array of tags to add to the ticket. Note that the tags replace any existing tags. |
|
322
|
+
| external\_id | A unique external ID to link Zendesk tickets to local records. |
|
323
|
+
| forum\_topic\_id | The numeric ID of the topic the ticket originated from, if any. |
|
324
|
+
| problem\_id | For tickets of type "incident", the numeric ID of the problem the incident is linked to, if any. |
|
325
|
+
| due\_at | For tickets of type "task", the due date of the task. Accepts the ISO 8601 date format (yyyy-mm-dd). |
|
326
|
+
| custom\_fields | An array of the custom field objects consisting of ids and values. Any tags defined with the custom field replace existing tags. |
|
327
|
+
|
328
|
+
#### Example request
|
329
|
+
|
330
|
+
```js
|
331
|
+
"ticket": {
|
332
|
+
"comment":{ "body": "Thanks for choosing Acme Jet Motors.", "public":"true" },
|
333
|
+
"status": "solved"
|
334
|
+
}
|
335
|
+
```
|
336
|
+
|
281
337
|
### Bulk Updating Tickets
|
282
338
|
`PUT /api/v2/tickets/update_many.json?ids={ids}`
|
283
339
|
|