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,279 @@
1
+ ## User Identities
2
+
3
+ A user identity is something that can be used to identify an individual. Most likely, it's an email address, a twitter handle or a phone number. Zendesk supports a series of different such identities.
4
+
5
+ ### JSON Format
6
+ User identities have the following keys:
7
+
8
+ | Name | Type | Read-only | Mandatory | Comment
9
+ | --------------- | ------- | --------- | --------- | -------
10
+ | id | integer | yes | no | Automatically assigned upon creation
11
+ | url | string | yes | no | The API url of this identity
12
+ | user_id | integer | yes | yes | The id of the user
13
+ | type | string | yes | yes | One of "email", "twitter", "facebook" or "google"
14
+ | value | string | yes | yes | The identifier for this identity, e.g. an email address
15
+ | verified | boolean | no | no | Is true of the identity has gone through verification
16
+ | primary | boolean | no | no | Is true of the primary identity of the user
17
+ | created_at | date | yes | no | The time the identity got created
18
+ | updated_at | date | yes | no | The time the identity got updated
19
+
20
+ #### Example
21
+ ```js
22
+ {
23
+ "id": 35436,
24
+ "url": "https://company.zendesk.com/api/v2/users/135/identities/35436.json",
25
+ "user_id": 135,
26
+ "type": "email",
27
+ "value": "someone@example.com",
28
+ "verified": true,
29
+ "primary": true,
30
+ "updated_at": "2011-07-20T22:55:29Z",
31
+ "created_at": "2011-07-20T22:55:29Z"
32
+ }
33
+ ```
34
+
35
+ ### List User Identities
36
+ `GET /api/v2/users/{user_id}/identities.json`
37
+
38
+ Returns all user identities for a given user id
39
+
40
+ #### Allowed For
41
+
42
+ * Agents
43
+
44
+ #### Using curl
45
+
46
+ ```bash
47
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities.json \
48
+ -v -u {email_address}:{password}
49
+ ```
50
+
51
+ #### Example Response:
52
+
53
+ ```http
54
+ Status: 200 OK
55
+
56
+ {
57
+ "identities": [
58
+ {
59
+ "id": 35436,
60
+ "user_id": 135,
61
+ "type": "email",
62
+ "value": "someone@example.com",
63
+ "verified": true,
64
+ "primary": true,
65
+ "updated_at": "2011-07-20T22:55:29Z",
66
+ "created_at": "2011-07-20T22:55:29Z"
67
+ },
68
+ {
69
+ "id": 77136,
70
+ "user_id": 135,
71
+ "type": "twitter",
72
+ "value": "didgeridooboy",
73
+ "verified": true,
74
+ "primary": false,
75
+ "updated_at": "2012-02-12T14:25:21Z",
76
+ "created_at": "2012-02-12T14:25:21Z"
77
+ }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ ### Show a User Identity
83
+ `GET /api/v2/users/{user_id}/identities/{id}.json`
84
+
85
+ Shows the identity with the given id
86
+
87
+ #### Allowed For
88
+
89
+ * Agents
90
+
91
+ #### Using curl
92
+
93
+ ```bash
94
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{id}.json \
95
+ -v -u {email_address}:{password}
96
+ ```
97
+
98
+ #### Example Response:
99
+
100
+ ```http
101
+ Status: 200 OK
102
+
103
+ {
104
+ "id": 77938,
105
+ "user_id": 13531,
106
+ "type": "twitter",
107
+ "value": "cabanaboy",
108
+ "verified": false,
109
+ "primary": false,
110
+ "updated_at": "2012-02-12T14:25:21Z",
111
+ "created_at": "2012-02-12T14:25:21Z"
112
+ }
113
+ ```
114
+
115
+ ### Add User Identity
116
+ `POST /api/v2/users/{user_id}/identities.json`
117
+
118
+ Add new identities for a given user id. Identities that can be added are:
119
+
120
+ * email - e.g., `{ "type" : "email", "value" : "someone@example.com" }`
121
+ * twitter - e.g., `{ "type" : "twitter", "value" : "screen_name" }`
122
+ * facebook - e.g., `{ "type" : "facebook", "value" : "855769377321" }`
123
+ * google - e.g., `{ "type" : "google", "value" : "example@gmail.com" }`
124
+
125
+ If you need to create an identity without sending out a verification email, pass a `"verified": true` parameter.
126
+
127
+ #### Allowed For
128
+
129
+ * Agents
130
+
131
+ #### Using curl
132
+
133
+ ```bash
134
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities.json \
135
+ -H "Content-Type: application/json" -X POST \
136
+ -d '{"identity": {"type": "email", "value": "foo@bar.com"}}' -v -u {email_address}:{password}
137
+ ```
138
+
139
+ #### Example Response
140
+
141
+ ```http
142
+ Status: 201 Created
143
+ Location: https://{subdomain}.zendesk.com/api/v2/users/135/identities/78138.json
144
+
145
+ {
146
+ "id": 78138,
147
+ "user_id": 135,
148
+ "type": "twitter",
149
+ "value": "cabanaboy",
150
+ "verified": false,
151
+ "primary": false,
152
+ "updated_at": "2012-02-12T14:25:21Z",
153
+ "created_at": "2012-02-12T14:25:21Z"
154
+ }
155
+ ```
156
+
157
+ ### Update a given User Identity
158
+ `PUT /api/v2/users/{user_id}/identities/{id}.json?identity[verified]=true`
159
+
160
+ This API method only allows you to set an identity as verified. You cannot otherwise
161
+ change value of an identity but must create a new identity and delete the one you're
162
+ replacing.
163
+
164
+ #### Allowed For
165
+
166
+ * Agents
167
+
168
+ #### Using curl
169
+
170
+ ```bash
171
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{id}.json \
172
+ -H "Content-Type: application/json" -X PUT \
173
+ -d '{"identity": {"verified": true}}' -v -u {email_address}:{password}
174
+ ```
175
+
176
+ #### Example Response
177
+
178
+ ```http
179
+ Status: 200 OK
180
+
181
+ {
182
+ "id": 78138,
183
+ "user_id": 135,
184
+ "type": "twitter",
185
+ "value": "cabanaboy",
186
+ "verified": true,
187
+ "primary": false,
188
+ "updated_at": "2012-02-12T14:25:21Z",
189
+ "created_at": "2012-02-12T14:25:21Z"
190
+ }
191
+ ```
192
+
193
+ ### Make a User Identity the Primary
194
+ `PUT /api/v2/users/{user_id}/identities/{id}/make_primary`
195
+
196
+ This API method only allows you to set an identity to primary. If you wish to change an identity, you
197
+ create a new one with the correct value and delete the old one. This is a collection level operation
198
+ and the correct behavior for an API client is to subsequently reload the entire collection.
199
+
200
+ #### Allowed For
201
+
202
+ * Agents
203
+
204
+ #### Using curl
205
+
206
+ ```bash
207
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{id}/make_primary.json \
208
+ -X PUT -v -u {email_address}:{password}
209
+ ```
210
+
211
+ #### Example Response
212
+
213
+ Same as List User Identities
214
+
215
+
216
+ ### Verify a given User Identity
217
+ `PUT /users/{user_id}/identities/{id}/verify`
218
+
219
+ This API method only allows you to set an identity as verified.
220
+
221
+ #### Allowed For
222
+
223
+ * Agents
224
+
225
+ #### Using curl
226
+
227
+ ```bash
228
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{id}/verify.json \
229
+ -X PUT -v -u {email_address}:{password}
230
+ ```
231
+
232
+ #### Example Response
233
+
234
+ Same as Show a User Identity
235
+
236
+
237
+ ### Request User Verification
238
+ `PUT /users/{user_id}/identities/{id}/request_verification
239
+
240
+ This sends a verification email to the user, asking him to click a link in order to verify ownership of the email address
241
+
242
+ #### Allowed For
243
+
244
+ * Agents
245
+
246
+ #### Using curl
247
+
248
+ ```bash
249
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{id}/request_verification.json \
250
+ -X PUT -v -u {email_address}:{password}
251
+ ```
252
+
253
+ #### Example Response
254
+
255
+ ```http
256
+ Status: 200 OK
257
+ ```
258
+
259
+ ### Delete User Identity
260
+ `DELETE /users/{user_id}/identities/{id}.json`
261
+
262
+ Delete identity for a given user
263
+
264
+ #### Allowed For
265
+
266
+ * Agents
267
+
268
+ #### Using curl
269
+
270
+ ```bash
271
+ curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/identities/{id}.json \
272
+ -X DELETE -v -u {email_address}:{password}
273
+ ```
274
+
275
+ #### Example Response
276
+
277
+ ```http
278
+ Status: 200 OK
279
+ ```
@@ -0,0 +1,400 @@
1
+ ## Users
2
+
3
+ Zendesk has three main types of users: End-users (your customers), Agents and Administrators.
4
+
5
+ #### End-users
6
+
7
+ End-users request support via Tickets. End-users have access to the Zendesk end-user portal where they can view forum content, access their ticket history, and submit new Tickets.
8
+
9
+ #### Agents
10
+
11
+ Agents work in Zendesk to solve Tickets. Agents can be divided into multiple Groups and can also belong to multiple Groups. Agents do not have access to administrative configuration in Zendesk such as business rules or automations, but can configure their own Macros and Views.
12
+
13
+ #### Administrators
14
+
15
+ Administrators have all the abilities of Agents, plus administrative abilities. Accounts on the Enterprise plan can configure custom roles to give Agents varying degrees of administrative access.
16
+
17
+ ### Show Requested Tickets, CCed Tickets and Topics for a User
18
+
19
+ See our Tickets API to retrieve [tickets requested by a User](tickets.html#listing-tickets), [tickets on which a user is CCed](tickets.html#listing-tickets).
20
+
21
+ See our Topics API to retrieve [topics created by a User](topics.html#list-topics) and [topic comments from a User](topic_comments.html#list-topic-comments).
22
+
23
+ ### JSON Format
24
+ Users are represented as JSON objects which have the following keys:
25
+
26
+ | Name | Type | Read-only | Mandatory | Comment
27
+ | --------------------- | ---------------------------- | --------- | --------- | -------
28
+ | id | integer | yes | no | Automatically assigned when creating users
29
+ | url | string | yes | no | The API url of this user
30
+ | name | string | no | yes | The name of the user
31
+ | external_id | string | no | no | A unique id you can set on a user
32
+ | alias | string | no | no | Agents can have an alias that is displayed to end-users
33
+ | created_at | date | yes | no | The time the user was created
34
+ | updated_at | date | yes | no | The time of the last update of the user
35
+ | active | boolean | yes | no | Users that have been deleted will have the value `false` here
36
+ | verified | boolean | no | no | Zendesk has verified that this user is who he says he is
37
+ | shared | boolean | yes | no | If this user is shared from a different Zendesk, ticket sharing accounts only
38
+ | locale_id | integer | no | no | The language identifier for this user
39
+ | time_zone | string | no | no | The time-zone of this user
40
+ | last_login_at | date | yes | no | A time-stamp of the last time this user logged in to Zendesk
41
+ | email | string | no | yes | The primary email address of this user
42
+ | phone | string | no | no | The primary phone number of this user
43
+ | signature | string | no | no | The signature of this user. Only agents and admins can have signatures
44
+ | details | string | no | no | In this field you can store any details obout the user. e.g. the address
45
+ | notes | string | no | no | In this field you can store any notes you have about the user
46
+ | organization_id | integer | no | no | The id of the organization this user is associated with
47
+ | role | string | no | yes | The role of the user. Possible values: `"end-user"`, `"agent"`, `"admin"`
48
+ | custom_role_id | integer | no | no | A custom role on the user if the user is an agent on the entreprise plan
49
+ | moderator | boolean | no | no | Designates whether this user has forum moderation capabilities
50
+ | ticket_restriction | string | no | no | Specified which tickets this user has access to. Possible values are: `"organization"`, `"groups"`, `"assigned"`, `"requested"`, `null`
51
+ | only_private_comments | boolean | no | no | `true` if this user only can create private comments
52
+ | tags | array | no | no | The tags of the user. Only present if your account has user tagging enabled
53
+ | suspended | boolean | no | no | Tickets from suspended users are also suspended, and these users cannot log in to the end-user portal
54
+ | photo | [Attachment](attachments.md) | no | no | The user's profile picture represented as an [Attachment](attachments.md) object
55
+
56
+ #### Example
57
+ ```js
58
+ {
59
+ "id": 35436,
60
+ "url": "https://company.zendesk.com/api/v2/users/35436.json",
61
+ "name": "Johnny Agent",
62
+ "external_id": "sai989sur98w9",
63
+ "alias": "Mr. Johnny",
64
+ "created_at": "2009-07-20T22:55:29Z",
65
+ "updated_at": "2011-05-05T10:38:52Z",
66
+ "active": true,
67
+ "verified": true,
68
+ "shared": false,
69
+ "locale_id": 1,
70
+ "time_zone": "Copenhagen",
71
+ "last_login_at": "2011-05-05T10:38:52Z",
72
+ "email": "johnny@example.com",
73
+ "phone": "555-123-4567",
74
+ "signature": "Have a nice day, Johnny",
75
+ "details": "",
76
+ "notes": "Johnny is a nice guy!",
77
+ "organization_id": 57542,
78
+ "role": "agent",
79
+ "custom_role_id": 9373643,
80
+ "moderator": true,
81
+ "ticket_restriction": "assigned",
82
+ "only_private_comments": false,
83
+ "tags": ["enterprise", "other_tag"],
84
+ "suspended": true,
85
+ "photo": {
86
+ "id": 928374,
87
+ "name": "my_funny_profile_pic.png",
88
+ "content_url": "https://company.zendesk.com/photos/my_funny_profile_pic.png",
89
+ "content_type": "image/png",
90
+ "size": 166144,
91
+ "thumbnails": [
92
+ {
93
+ "id": 928375,
94
+ "name": "my_funny_profile_pic_thumb.png",
95
+ "content_url": "https://company.zendesk.com/photos/my_funny_profile_pic_thumb.png",
96
+ "content_type": "image/png",
97
+ "size": 58298,
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ ```
103
+
104
+ ### List Users
105
+
106
+ `GET /api/v2/users.json`
107
+
108
+ `GET /api/v2/groups/{id}/users.json`
109
+
110
+ `GET /api/v2/organizations/{id}/users.json`
111
+
112
+ #### Allowed For
113
+
114
+ * Agents
115
+
116
+ #### Using curl
117
+
118
+ ```bash
119
+ curl https://{subdomain}.zendesk.com/api/v2/users.json \
120
+ -v -u {email_address}:{password}
121
+ ```
122
+
123
+ #### Example Response
124
+
125
+ ```http
126
+ Status: 200
127
+
128
+ {
129
+ "users": [
130
+ {
131
+ "id": 223443,
132
+ "name": "Johnny Agent",
133
+ ...
134
+ },
135
+ {
136
+ "id": 8678530,
137
+ "name": "James A. Rosen",
138
+ ...
139
+ }
140
+ ]
141
+ }
142
+ ```
143
+
144
+ ### Show User
145
+
146
+ `GET /api/v2/users/{id}.json`
147
+
148
+ #### Allowed For:
149
+
150
+ * Agents
151
+
152
+ #### Using curl:
153
+
154
+ ```bash
155
+ curl https://{subdomain}.zendesk.com/api/v2/users/{id}.json \
156
+ -v -u {email_address}:{password}
157
+ ```
158
+
159
+ #### Example Response
160
+
161
+ ```http
162
+ Status: 200
163
+
164
+ {
165
+ "user": {
166
+ "id": 35436,
167
+ "name": "Johnny Agent",
168
+ ...
169
+ }
170
+ }
171
+ ```
172
+
173
+ ### Create User
174
+ `POST /api/v2/users.json`
175
+
176
+ #### Allowed For
177
+
178
+ * Agents, restrictions apply on certain actions
179
+
180
+ #### Using curl
181
+
182
+ ```bash
183
+ curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/users.json \
184
+ -H "Content-Type: application/json" -X POST -d '{"user": {"name": "Roger Wilco", "email": "roge@example.org"}}'
185
+ ```
186
+
187
+ If you need to create users without sending out a verification email, pass a `"verified": true` parameter.
188
+
189
+ #### Example Response
190
+
191
+ ```http
192
+ Status: 201 Created
193
+ Location: /api/v2/users/{new-user-id}.json
194
+
195
+ {
196
+ "user": {
197
+ "id": 9873843,
198
+ "name": "Roger Wilco",
199
+ ...
200
+ }
201
+ }
202
+ ```
203
+
204
+ ### Create Many Users
205
+ `POST /api/v2/users/create_many.json`
206
+
207
+ #### Allowed For
208
+
209
+ * Agents, restrictions apply on certain actions
210
+
211
+ #### Using curl
212
+
213
+ ```bash
214
+ curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/users/create_many.json \
215
+ -H "Content-Type: application/json" -X POST -d '{"users": [{"name": "Roger Wilco", "email": "roge@example.org", "role": "agent"}, {"name": "Woger Rilco", "email": "woge@example.org", "role": "admin"}]}'
216
+ ```
217
+
218
+ #### Example Response
219
+
220
+ See [Job Status](job_statuses.md#show-job-status)
221
+
222
+ ### Update User
223
+ `PUT /api/v2/users/{id}.json`
224
+
225
+ #### Allowed For
226
+
227
+ * Agents, restrictions apply on certain actions
228
+
229
+ #### Using curl
230
+
231
+ ```bash
232
+ curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/users/{id}.json \
233
+ -H "Content-Type: application/json" -X PUT -d '{"user": {"name": "Roger Wilco II"}}'
234
+ ```
235
+
236
+ #### Example Response
237
+
238
+ ```http
239
+ Status: 200 OK
240
+
241
+ {
242
+ "user": {
243
+ "id": 9873843,
244
+ "name": "Roger Wilco II",
245
+ ...
246
+ }
247
+ }
248
+ ```
249
+
250
+ ### Suspending a User
251
+
252
+ You can suspend a User by setting its `suspended` attribute to `true`.
253
+
254
+ When a User is suspended, the User is not allowed to login to the end-user portal and
255
+ all further tickes are suspended.
256
+
257
+ #### Using curl
258
+
259
+ ```bash
260
+ curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/users/{id}.json \
261
+ -H "Content-Type: application/json" -X PUT -d '{"user": {"suspended":true}}'
262
+ ```
263
+
264
+ #### Example Response
265
+
266
+ ```js
267
+ {
268
+ "user": {
269
+ "id": 9873843,
270
+ "name": "Roger Wilco II",
271
+ "suspended": true,
272
+ ...
273
+ }
274
+ }
275
+ ```
276
+
277
+ ### Delete User
278
+ `DELETE /api/v2/users/{id}.json`
279
+
280
+ #### Allowed For
281
+
282
+ * Agents, restrictions apply on certain actions
283
+
284
+ #### Using curl
285
+
286
+ ```bash
287
+ curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/users/{id}.json \
288
+ -X DELETE
289
+ ```
290
+
291
+ #### Example Response
292
+
293
+ ```http
294
+ Status: 200 OK
295
+
296
+ {
297
+ "user": {
298
+ "id": 9873843,
299
+ "name": "Roger Wilco II",
300
+ ...
301
+ "active": false,
302
+ ...
303
+ }
304
+ }
305
+ ```
306
+
307
+ ### Search Users
308
+ `GET /api/v2/users/search.json?query={query}`
309
+
310
+ `GET /api/v2/users/search.json?external_id={external_id}`
311
+
312
+ You can find a specific user given their `external_id` attribute or email address. Or perform
313
+ a search across usernames and email addresses.
314
+
315
+ #### Allowed For:
316
+
317
+ * Agents
318
+
319
+ #### Example Response
320
+
321
+ ```http
322
+ Status: 200
323
+
324
+ [
325
+ { .. user record as in the #show method .. },
326
+ { .. user record as in the #show method .. }
327
+ ]
328
+ ```
329
+
330
+ ### Autocomplete Users
331
+ `POST /api/v2/users/autocomplete.json?name={name}`
332
+
333
+
334
+ #### Allowed For
335
+
336
+ * Agents
337
+
338
+ #### Using curl
339
+
340
+ ```bash
341
+ curl https://{subdomain}.zendesk.com/api/v2/users/autocomplete.json \
342
+ -X POST -d '{"name": "att"}' -H "Accept: application/json" \
343
+ -u {email_address}:{password}
344
+ ```
345
+
346
+ #### Example Response
347
+
348
+ ```http
349
+ Status: 200
350
+
351
+ [
352
+ { .. user record as in the #show method .. },
353
+ { .. user record as in the #show method .. }
354
+ ]
355
+ ```
356
+
357
+ ### Update a User's Profile Image
358
+
359
+ A user's profile image can be updated by uploading a local file or by
360
+ referring to an image hosted on a different website. The latter may take
361
+ a few minutes to process.
362
+
363
+ #### Using curl
364
+
365
+ Uploading a local file.
366
+
367
+ ```bash
368
+ curl -v -u {email_address}:{password} -X PUT \
369
+ -F "user[photo][uploaded_data]=@/path/to/profile/image.jpg" \
370
+ http://{subdomain}.zendesk.com/api/v2/users/{id}.json
371
+ ```
372
+
373
+ Setting a remote image URL.
374
+
375
+ ```bash
376
+ curl -v -u {email_address}:{password} -X PUT -H "Content-Type: application/json" \
377
+ -d '{"user": {"remote_photo_url": "http://link.to/profile/image.png"}}' \
378
+ http://{subdomain}.zendesk.com/api/v2/users/{id}.json
379
+ ```
380
+
381
+ ### Show the Currently Authenticated User
382
+ `GET /api/v2/users/me.json`
383
+
384
+ #### Allowed For:
385
+
386
+ * Anyone
387
+
388
+ #### Example Response
389
+
390
+ ```http
391
+ Status: 200
392
+
393
+ {
394
+ "user": {
395
+ "id": 35436,
396
+ "name": "Roger Wilco",
397
+ ...
398
+ }
399
+ }
400
+ ```