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,124 @@
|
|
1
|
+
## Locales
|
2
|
+
|
3
|
+
### List Locales
|
4
|
+
`GET /api/v2/locales.json`
|
5
|
+
|
6
|
+
This lists the translation locales that are available for the account.
|
7
|
+
|
8
|
+
#### Allowed For:
|
9
|
+
|
10
|
+
* Anyone
|
11
|
+
|
12
|
+
#### Using curl
|
13
|
+
|
14
|
+
```bash
|
15
|
+
curl https://{subdomain}.zendesk.com/api/v2/locales.json \
|
16
|
+
-v -u {email_address}:{password}
|
17
|
+
```
|
18
|
+
|
19
|
+
#### Example Response
|
20
|
+
|
21
|
+
```http
|
22
|
+
Status: 200 OK
|
23
|
+
|
24
|
+
{
|
25
|
+
"locales": [
|
26
|
+
{
|
27
|
+
"id": 1,
|
28
|
+
"url": "https://company.zendesk.com/api/v2/locales/1.json",
|
29
|
+
"locale": "en-US",
|
30
|
+
"name": "English",
|
31
|
+
"created_at": "2009-07-20T22:55:29Z",
|
32
|
+
"updated_at": "2011-05-05T10:38:52Z"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"id": 8,
|
36
|
+
"url": "https://company.zendesk.com/api/v2/locales/8.json",
|
37
|
+
"locale": "de",
|
38
|
+
"name": "Deutsch",
|
39
|
+
"created_at": "2010-12-23T12:45:22Z",
|
40
|
+
"updated_at": "2012-04-01T10:44:12Z"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
```
|
45
|
+
|
46
|
+
### List Locales
|
47
|
+
`GET /api/v2/locales/agent.json`
|
48
|
+
|
49
|
+
This lists the translation locales that have been localized for agents.
|
50
|
+
|
51
|
+
#### Allowed For:
|
52
|
+
|
53
|
+
* Anyone
|
54
|
+
|
55
|
+
#### Using curl
|
56
|
+
|
57
|
+
```bash
|
58
|
+
curl https://{subdomain}.zendesk.com/api/v2/locales/agent.json \
|
59
|
+
-v -u {email_address}:{password}
|
60
|
+
```
|
61
|
+
|
62
|
+
#### Example Response
|
63
|
+
|
64
|
+
```http
|
65
|
+
Status: 200 OK
|
66
|
+
|
67
|
+
{
|
68
|
+
"locales": [
|
69
|
+
{
|
70
|
+
"id": 1,
|
71
|
+
"url": "https://company.zendesk.com/api/v2/locales/1.json",
|
72
|
+
"locale": "en-US",
|
73
|
+
"name": "English",
|
74
|
+
"created_at": "2009-07-20T22:55:29Z",
|
75
|
+
"updated_at": "2011-05-05T10:38:52Z"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"id": 8,
|
79
|
+
"url": "https://company.zendesk.com/api/v2/locales/8.json",
|
80
|
+
"locale": "de",
|
81
|
+
"name": "Deutsch",
|
82
|
+
"created_at": "2010-12-23T12:45:22Z",
|
83
|
+
"updated_at": "2012-04-01T10:44:12Z"
|
84
|
+
}
|
85
|
+
]
|
86
|
+
}
|
87
|
+
```
|
88
|
+
|
89
|
+
### Show Locale
|
90
|
+
`GET /api/v2/locales/{id}.json`
|
91
|
+
|
92
|
+
#### Allowed For
|
93
|
+
|
94
|
+
* Anyone
|
95
|
+
|
96
|
+
#### Using curl
|
97
|
+
|
98
|
+
```bash
|
99
|
+
curl https://{subdomain}.zendesk.com/api/v2/locales/{id}.json \
|
100
|
+
-v -u {email_address}:{password}
|
101
|
+
```
|
102
|
+
|
103
|
+
#### Example Response
|
104
|
+
|
105
|
+
```http
|
106
|
+
Status: 200 OK
|
107
|
+
|
108
|
+
{
|
109
|
+
"locale": {
|
110
|
+
"id": 8,
|
111
|
+
"url": "https://company.zendesk.com/api/v2/locales/8.json",
|
112
|
+
"locale": "de",
|
113
|
+
"name": "Deutsch",
|
114
|
+
"created_at": "2010-12-23T12:45:22Z",
|
115
|
+
"updated_at": "2012-04-01T10:44:12Z",
|
116
|
+
}
|
117
|
+
}
|
118
|
+
```
|
119
|
+
|
120
|
+
### Show Current Locale
|
121
|
+
`GET /api/v2/locales/current.json`
|
122
|
+
|
123
|
+
This works exactly like show, but instead of taking an id as argument, it renders the locale
|
124
|
+
of the user performing the request.
|
@@ -0,0 +1,287 @@
|
|
1
|
+
## Macros
|
2
|
+
|
3
|
+
### JSON Format
|
4
|
+
Macros 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 macro
|
10
|
+
| active | boolean | Useful for determining if the macro should be displayed
|
11
|
+
| restriction | object | Who may access this macro. Will be null when everyone in the account can access it.
|
12
|
+
| actions | [Actions](#actions) | An object describing what the macro will do
|
13
|
+
| created_at | date | The time the macro was created
|
14
|
+
| updated_at | date | The time of the last update of the macro
|
15
|
+
|
16
|
+
#### Example
|
17
|
+
```js
|
18
|
+
{
|
19
|
+
"macro": {
|
20
|
+
"id": 25,
|
21
|
+
"title": "Tickets updated <12 Hours",
|
22
|
+
"active": true,
|
23
|
+
"actions": { ... },
|
24
|
+
"restriction": {
|
25
|
+
"type": "User",
|
26
|
+
"id": 4
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
### Actions
|
33
|
+
The actions that will be applied to the ticket.
|
34
|
+
|
35
|
+
| Name | Type | Comment
|
36
|
+
| ------------ | ------- | -------
|
37
|
+
| field | string | The ticket field being modified
|
38
|
+
| value | string | The new value of the field
|
39
|
+
|
40
|
+
#### Example
|
41
|
+
```js
|
42
|
+
{
|
43
|
+
"actions": [
|
44
|
+
{ "field": "status", "value": "solved" },
|
45
|
+
{ "field": "assignee", "value": "me" },
|
46
|
+
]
|
47
|
+
}
|
48
|
+
```
|
49
|
+
|
50
|
+
### List Macros
|
51
|
+
`GET /api/v2/macros.json`
|
52
|
+
|
53
|
+
Lists all shared and personal macros available to the current user
|
54
|
+
|
55
|
+
#### Allowed For:
|
56
|
+
|
57
|
+
* Agents
|
58
|
+
|
59
|
+
#### Using curl
|
60
|
+
|
61
|
+
```bash
|
62
|
+
curl https://{subdomain}.zendesk.com/api/v2/macros.json \
|
63
|
+
-v -u {email_address}:{password}
|
64
|
+
```
|
65
|
+
|
66
|
+
#### Example Response
|
67
|
+
|
68
|
+
```http
|
69
|
+
Status: 200 OK
|
70
|
+
|
71
|
+
{
|
72
|
+
"macros": [
|
73
|
+
{
|
74
|
+
"id": 25,
|
75
|
+
"title": "Close and Save",
|
76
|
+
"active": true
|
77
|
+
"actions": [ ... ],
|
78
|
+
"restriction": { ... }
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"id": 26,
|
82
|
+
"title": "Assign priority tag",
|
83
|
+
"active": false
|
84
|
+
"actions": [ ... ],
|
85
|
+
"restriction": { ... }
|
86
|
+
}
|
87
|
+
],
|
88
|
+
"count": 2,
|
89
|
+
"previous_page": null,
|
90
|
+
"next_page": null
|
91
|
+
}
|
92
|
+
```
|
93
|
+
|
94
|
+
### Getting Macros
|
95
|
+
`GET /api/v2/macros/{id}.json`
|
96
|
+
|
97
|
+
#### Allowed For:
|
98
|
+
|
99
|
+
* Agents
|
100
|
+
|
101
|
+
#### Using curl
|
102
|
+
|
103
|
+
```bash
|
104
|
+
curl https://{subdomain}.zendesk.com/api/v2/macros/{id}.json \
|
105
|
+
-v -u {email_address}:{password}
|
106
|
+
```
|
107
|
+
|
108
|
+
#### Example Response
|
109
|
+
|
110
|
+
```http
|
111
|
+
Status: 200 OK
|
112
|
+
|
113
|
+
{
|
114
|
+
"macro": {
|
115
|
+
"id": 25,
|
116
|
+
"title": "Tickets updated <12 Hours",
|
117
|
+
"active": true
|
118
|
+
"actions": [ ... ],
|
119
|
+
"restriction": { ... }
|
120
|
+
}
|
121
|
+
}
|
122
|
+
```
|
123
|
+
|
124
|
+
### List active Macros
|
125
|
+
`GET /api/v2/macros/active.json`
|
126
|
+
|
127
|
+
Lists all active shared and personal macros available to the current user
|
128
|
+
|
129
|
+
#### Allowed For:
|
130
|
+
|
131
|
+
* Agents
|
132
|
+
|
133
|
+
#### Using curl
|
134
|
+
|
135
|
+
```bash
|
136
|
+
curl https://{subdomain}.zendesk.com/api/v2/macros/active.json \
|
137
|
+
-v -u {email_address}:{password}
|
138
|
+
```
|
139
|
+
|
140
|
+
#### Example Response
|
141
|
+
|
142
|
+
```http
|
143
|
+
Status: 200 OK
|
144
|
+
|
145
|
+
{
|
146
|
+
"macros": [
|
147
|
+
{
|
148
|
+
"id": 25,
|
149
|
+
"title": "Close and Save",
|
150
|
+
"active": true
|
151
|
+
"actions": [ ... ],
|
152
|
+
"restriction": { ... }
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"id": 28,
|
156
|
+
"title": "Close and redirect to topics",
|
157
|
+
"active": true
|
158
|
+
"actions": [ ... ],
|
159
|
+
"restriction": { ... }
|
160
|
+
}
|
161
|
+
],
|
162
|
+
"count": 2,
|
163
|
+
"previous_page": null,
|
164
|
+
"next_page": null
|
165
|
+
}
|
166
|
+
```
|
167
|
+
|
168
|
+
### Create Macro
|
169
|
+
`POST /api/v2/macros.json`
|
170
|
+
|
171
|
+
#### Allowed For
|
172
|
+
|
173
|
+
* Agents
|
174
|
+
|
175
|
+
#### Using curl
|
176
|
+
|
177
|
+
```bash
|
178
|
+
curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/macros.json \
|
179
|
+
-H "Content-Type: application/json" -X POST -d '{"macro": {"title": "Roger Wilco", "actions": [{ "field": "status", "value": "open" }]}}'
|
180
|
+
```
|
181
|
+
|
182
|
+
#### Example Response
|
183
|
+
|
184
|
+
```http
|
185
|
+
Status: 201 Created
|
186
|
+
Location: /api/v2/macros/{new-macro-id}.json
|
187
|
+
|
188
|
+
{
|
189
|
+
"macro": {
|
190
|
+
"id": 9873843,
|
191
|
+
"title": "Roger Wilco",
|
192
|
+
...
|
193
|
+
}
|
194
|
+
}
|
195
|
+
```
|
196
|
+
|
197
|
+
### Update Macro
|
198
|
+
`PUT /api/v2/macros/{id}.json`
|
199
|
+
|
200
|
+
#### Allowed For
|
201
|
+
|
202
|
+
* Agents
|
203
|
+
|
204
|
+
#### Using curl
|
205
|
+
|
206
|
+
```bash
|
207
|
+
curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/macros/{id}.json \
|
208
|
+
-H "Content-Type: application/json" -X PUT -d '{"macro": {"title": "Roger Wilco II"}}'
|
209
|
+
```
|
210
|
+
|
211
|
+
#### Example Response
|
212
|
+
|
213
|
+
```http
|
214
|
+
Status: 200 OK
|
215
|
+
|
216
|
+
{
|
217
|
+
"macro": {
|
218
|
+
"id": 9873843,
|
219
|
+
"title": "Roger Wilco II",
|
220
|
+
...
|
221
|
+
}
|
222
|
+
}
|
223
|
+
```
|
224
|
+
|
225
|
+
### Delete Macro
|
226
|
+
`DELETE /api/v2/macros/{id}.json`
|
227
|
+
|
228
|
+
#### Allowed For
|
229
|
+
|
230
|
+
* Agents, restrictions apply on certain actions
|
231
|
+
|
232
|
+
#### Using curl
|
233
|
+
|
234
|
+
```bash
|
235
|
+
curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/macros/{id}.json \
|
236
|
+
-X DELETE
|
237
|
+
```
|
238
|
+
|
239
|
+
#### Example Response
|
240
|
+
|
241
|
+
```http
|
242
|
+
Status: 200 OK
|
243
|
+
```
|
244
|
+
|
245
|
+
### Apply Macros
|
246
|
+
`GET /api/v2/macros/{id}/apply.json`
|
247
|
+
|
248
|
+
`GET /api/v2/tickets/{ticket_id}/macros/{id}/apply.json`
|
249
|
+
|
250
|
+
Applies a macro to a specific ticket, or to all applicable tickets.
|
251
|
+
|
252
|
+
#### Allowed For:
|
253
|
+
|
254
|
+
* Agents
|
255
|
+
|
256
|
+
#### Using curl
|
257
|
+
|
258
|
+
```bash
|
259
|
+
curl https://{subdomain}.zendesk.com/api/v2/tickets/{ticket_id}/macros/{id}/apply.json \
|
260
|
+
-u {email_address}:{password}
|
261
|
+
```
|
262
|
+
|
263
|
+
#### Example Response
|
264
|
+
|
265
|
+
```json
|
266
|
+
{
|
267
|
+
"result": {
|
268
|
+
"ticket": {
|
269
|
+
"id": 35436,
|
270
|
+
"url": "https://company.zendesk.com/api/v2/tickets/35436.json",
|
271
|
+
"assignee_id": 235323,
|
272
|
+
"group_id": 98738,
|
273
|
+
"fields": [
|
274
|
+
{
|
275
|
+
"id": 27642,
|
276
|
+
"value": "745"
|
277
|
+
}
|
278
|
+
],
|
279
|
+
...
|
280
|
+
},
|
281
|
+
"comment": {
|
282
|
+
"body": "Assigned to Agent Uno.",
|
283
|
+
"public": false
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
```
|
@@ -0,0 +1,253 @@
|
|
1
|
+
## Organizations
|
2
|
+
|
3
|
+
Just as agents can be segmented into Groups in Zendesk, your customers (end-users) can be segmented into Organizations. You can manually assign customers to an Organization or automatically assign them to an Organization by their email address domain. Organizations can be used in business rules to route Tickets to Groups of agents or send special email notifications.
|
4
|
+
|
5
|
+
### JSON Format
|
6
|
+
Organizations are represented as simple flat JSON objects which have the following keys:
|
7
|
+
|
8
|
+
| Name | Type | Read-only | Mandatory | Comment
|
9
|
+
| --------------- | ------- | --------- | --------- | -------
|
10
|
+
| id | integer | yes | no | Automatically assigned when creating organization
|
11
|
+
| external_id | string | no | no | A unique external id, you can use this to associate organizations to an external record
|
12
|
+
| name | string | no | yes | The name of the organization
|
13
|
+
| created_at | date | yes | no | The time the organization was created
|
14
|
+
| updated_at | date | yes | no | The time of the last update of the organization
|
15
|
+
| domain_names | array | no | no | An array of domain names associated with this organization
|
16
|
+
| details | string | no | no | In this field you can store any details obout the organization. e.g. the address
|
17
|
+
| notes | string | no | no | In this field you can store any notes you have about the organization
|
18
|
+
| group_id | integer | no | no | New tickets from users in this organization will automatically be put in this group
|
19
|
+
| shared_tickets | boolean | no | no | End users in this organization are able to see eachother's tickets
|
20
|
+
| shared_comments | boolean | no | no | End users in this organization are able to see eachother's comments on tickets
|
21
|
+
| tags | array | no | no | The tags of the organization
|
22
|
+
|
23
|
+
#### Example
|
24
|
+
```js
|
25
|
+
{
|
26
|
+
"id": 35436,
|
27
|
+
"external_id": "ABC123",
|
28
|
+
"url": "https://company.zendesk.com/api/v2/organizations/35436.json",
|
29
|
+
"name": "One Organization",
|
30
|
+
"created_at": "2009-07-20T22:55:29Z",
|
31
|
+
"updated_at": "2011-05-05T10:38:52Z",
|
32
|
+
"domain_names": ["example.com", "test.com"],
|
33
|
+
"details": "This is a kind of organization",
|
34
|
+
"notes": "",
|
35
|
+
"group_id": null,
|
36
|
+
"shared_tickets": true,
|
37
|
+
"shared_comments": true,
|
38
|
+
"tags": ["enterprise", "other_tag"]
|
39
|
+
}
|
40
|
+
```
|
41
|
+
|
42
|
+
### Listing Organizations
|
43
|
+
`GET /api/v2/organizations.json`
|
44
|
+
|
45
|
+
#### Allowed For
|
46
|
+
|
47
|
+
* Agents
|
48
|
+
|
49
|
+
#### Using curl
|
50
|
+
|
51
|
+
```bash
|
52
|
+
curl https://{subdomain}.zendesk.com/api/v2/organizations.json \
|
53
|
+
-v -u {email_address}:{password}
|
54
|
+
```
|
55
|
+
|
56
|
+
#### Example Response
|
57
|
+
```http
|
58
|
+
Status: 200 OK
|
59
|
+
|
60
|
+
{
|
61
|
+
"organizations": [
|
62
|
+
{
|
63
|
+
"id": 35436,
|
64
|
+
"name": "One Organization",
|
65
|
+
...
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"id": 20057623,
|
69
|
+
"name": "Other Organization",
|
70
|
+
...
|
71
|
+
},
|
72
|
+
]
|
73
|
+
}
|
74
|
+
```
|
75
|
+
|
76
|
+
### Autocomplete Organizations
|
77
|
+
`POST /api/v2/organizations/autocomplete.json?name={name}`
|
78
|
+
|
79
|
+
Returns an array of organizations whose name starts with the value specified
|
80
|
+
in the `name` parameter. The name must be at least 2 characters in length.
|
81
|
+
|
82
|
+
#### Allowed For
|
83
|
+
|
84
|
+
* Agents
|
85
|
+
|
86
|
+
#### Using curl
|
87
|
+
|
88
|
+
```bash
|
89
|
+
curl https://{subdomain}.zendesk.com/api/v2/organizations/autocomplete.json \
|
90
|
+
-X POST -d '{"name": "imp"}' -H "Content-Type: application/json" \
|
91
|
+
-u {email_address}:{password}
|
92
|
+
```
|
93
|
+
|
94
|
+
#### Example Response
|
95
|
+
|
96
|
+
```http
|
97
|
+
Status: 200 OK
|
98
|
+
|
99
|
+
{
|
100
|
+
"organizations": [
|
101
|
+
{
|
102
|
+
"id": 35436,
|
103
|
+
"name": "Important Customers",
|
104
|
+
...
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"id": 20057623,
|
108
|
+
"name": "Imperial College",
|
109
|
+
...
|
110
|
+
},
|
111
|
+
]
|
112
|
+
}
|
113
|
+
```
|
114
|
+
|
115
|
+
### Getting Organizations
|
116
|
+
`GET /api/v2/organizations/{id}.json`
|
117
|
+
|
118
|
+
#### Allowed For
|
119
|
+
|
120
|
+
* Admins
|
121
|
+
* Agents
|
122
|
+
|
123
|
+
#### Using curl
|
124
|
+
|
125
|
+
```bash
|
126
|
+
curl https://{subdomain}.zendesk.com/api/v2/organizations/{id}.json \
|
127
|
+
-v -u {email_address}:{password}
|
128
|
+
```
|
129
|
+
|
130
|
+
#### Example Response
|
131
|
+
|
132
|
+
```http
|
133
|
+
Status: 200 OK
|
134
|
+
|
135
|
+
{
|
136
|
+
"organization": {
|
137
|
+
{
|
138
|
+
"id": 35436,
|
139
|
+
"name": "My Organization",
|
140
|
+
...
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
```
|
145
|
+
|
146
|
+
### Creating Organizations
|
147
|
+
`POST /api/v2/organizations.json`
|
148
|
+
|
149
|
+
#### Allowed For
|
150
|
+
|
151
|
+
* Admins
|
152
|
+
|
153
|
+
#### Using curl
|
154
|
+
|
155
|
+
```bash
|
156
|
+
curl https://{subdomain}.zendesk.com/api/v2/organizations.json \
|
157
|
+
-H "Content-Type: application/json" -d '{"organization": {"name": "My Organization"}}' \
|
158
|
+
-v -u {email_address}:{password}
|
159
|
+
```
|
160
|
+
|
161
|
+
#### Example Response
|
162
|
+
|
163
|
+
```http
|
164
|
+
Status: 201 Created
|
165
|
+
Location: https://{subdomain}.zendesk.com/api/v2/organizations/{id}.json
|
166
|
+
|
167
|
+
{
|
168
|
+
"organization": {
|
169
|
+
{
|
170
|
+
"id": 35436,
|
171
|
+
"name": "My Organization",
|
172
|
+
...
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
```
|
177
|
+
|
178
|
+
### Updating Organizations
|
179
|
+
`PUT /api/v2/organizations/{id}.json`
|
180
|
+
|
181
|
+
#### Allowed For
|
182
|
+
|
183
|
+
* Admins
|
184
|
+
|
185
|
+
#### Example Request
|
186
|
+
|
187
|
+
```js
|
188
|
+
"organization": {
|
189
|
+
"notes": "Something interesting"
|
190
|
+
}
|
191
|
+
```
|
192
|
+
|
193
|
+
#### Using curl
|
194
|
+
|
195
|
+
```bash
|
196
|
+
curl https://{subdomain}.zendesk.com/api/v2/organizations/{id}.json \
|
197
|
+
-d '{"organization": {"notes": "Something interesting"}}' \
|
198
|
+
-v -u {email_address}:{password} -H "Content-Type: application/json"
|
199
|
+
```
|
200
|
+
|
201
|
+
#### Example Response
|
202
|
+
|
203
|
+
```http
|
204
|
+
Status: 200 OK
|
205
|
+
|
206
|
+
{
|
207
|
+
"organization": {
|
208
|
+
|
209
|
+
"id": 35436,
|
210
|
+
"name": "My Organization",
|
211
|
+
"notes": "Something interesting",
|
212
|
+
...
|
213
|
+
}
|
214
|
+
}
|
215
|
+
```
|
216
|
+
|
217
|
+
### Deleting Organizations
|
218
|
+
`DELETE /api/v2/organizations/{id}.json`
|
219
|
+
|
220
|
+
#### Allowed For
|
221
|
+
|
222
|
+
* Admins
|
223
|
+
|
224
|
+
#### Using curl
|
225
|
+
|
226
|
+
```bash
|
227
|
+
curl https://{subdomain}.zendesk.com/api/v2/organizations/{id}.json \
|
228
|
+
-v -u {email_address}:{password} -X DELETE
|
229
|
+
```
|
230
|
+
|
231
|
+
#### Example Response
|
232
|
+
|
233
|
+
```http
|
234
|
+
Status: 200 OK
|
235
|
+
```
|
236
|
+
|
237
|
+
### Search Organizations
|
238
|
+
`GET /api/v2/organizations/search.json?external_id={external_id}`
|
239
|
+
|
240
|
+
#### Allowed For:
|
241
|
+
|
242
|
+
* Agents
|
243
|
+
|
244
|
+
#### Using curl
|
245
|
+
|
246
|
+
```bash
|
247
|
+
curl https://{subdomain}.zendesk.com/api/v2/search.json?external_id={search term} \
|
248
|
+
-v -u {email_address}:{password}
|
249
|
+
```
|
250
|
+
|
251
|
+
#### Example Response
|
252
|
+
|
253
|
+
See [Listing Organizations](#listing-organizations)
|