REST API: Users

Users in your help desk are assigned one of the following roles:

Rolevalue
End user0
Administrator2
Agent4

Administrators always have Agent priviliges, in addition to Administrator priviliges.

Additionally, you can define ticket access restrictions for end-users and agents:

RestrictionValueApplicable
for end-users
Applicable
for agents
All tickets0x
Tickets in member groups1x
Tickets in member organization2xx
Assigned tickets3x
Tickets requested by user4x

Show

GET /users/#{id}.xml

Returns a single user.

Response

Status: 200 OK

<user>
  <created-at>2007-05-15T18:07:57Z</created-at>
  <email>aljohson@yourcompany.dk</email>
  <id>88</id>
  <is-active>true</is-active>
  <is-verified>true</is-verified>
  <name>Al Johnson</name>
  <roles>4</roles>
  <restriction-id>1</restriction-id>  
  <time-format>0</time-format>
  <time-zone>(GMT +01:00) Brussels, Copenhagen, Madrid, Paris</time-zone>
  <updated-at>2007-07-06T12:46:12Z</updated-at>
  <groups>
    <group>
      <id>13</id>
      <is-active>true</is-active>
      <name>Support</name>
    </group>
    <group>
      <id>3</id>
      <is-active>true</is-active>
      <name>Sales</name>
    </group>
  </groups>
</user>

This user is an agent, and is a member of 2 groups with access to tickets in member groups only.

List All

GET /users.xml

Returns all users in your help desk. The list is paginated using offsets. If 15 elements are returned (the page limit), use ?page=2 to check for the next 15 and so on.

Response

Status: 200 OK

<users>
  <user>
    ...
  </user>
  <user>
    ...
  </user>
</users>

List by search term

Get /users.xml?query=John&role=2

Returns a collection of users that has a name matching the query passed in through the URL. The list is paginated using offsets. If 15 elements are returned (the page limit), use ?page=2 to check for the next 15 and so on.

Response

Status: 200 OK

<users>
  <user>  
    ...    
    <name>John Smith</name>    
    <role>2</role>
  </user>
  <user>
    ...
    <name>Alexander Johnson</name>    
    <role>4</role>    
  </user>
</users>

Create

POST /users.xml

Creates a new user. The XML for the new user is returned on a successful request with the timestamps recorded and user id. If the account doesn't allow for more users to be created, a "507 Insufficient Storage" response will be returned.

Request

<user>
  <email>aljohson@yourcompany.dk</email>
  <name>Al Johnson</name>
  <roles>4</roles>
  <restriction-id>1</restriction-id>
</user>
<groups>
  2,3
</groups>

Response

Status: 201 Created
Location: http://account.zendesk.com/users/#{new-user-id}.xml

Adds an agent as a member of groups 2 and 3.

Update

PUT /users/#{id}.xml

Updates an existing user with new details from the submitted XML.

Request

<user>
  <name>Albert Johnson</name>
</user>
<groups>
  2
</groups>

Response

Status: 200 OK

Updates the user and sets the user to be a member of group 2 only. Omit the <groups> part, if you do not wish to change the users' group status.

Destroy

DELETE /users/#{id}.xml

Destroys the user at the referenced URL.

The user is not actually deleted from the system, but is set inactive and can no longer be assigned or submit tickets and entries.

Response

Status: 200 OK