Departments

If you are participating in the Zendesk messaging beta, some Chat APIs are not supported. See How Zendesk messaging impacts Chat APIs for more information.

You can use the API to get or set department information.

JSON Format

Departments are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
description string false false The description of the department
enabled integer false false Describes whether the department is enabled
id integer true false The ID of the department
members array false false The member agent IDs for the account
name string false false The name of the department
settings object false false The settings for the department
Example
{
  "description": "A sample department",
  "enabled": 1,
  "id": 1,
  "members": [
    1,
    2,
    3
  ],
  "name": "Department 1",
  "settings": {}
}

List Departments

  • GET /api/v2/departments

Fetches all the departments for your account.

Allowed for
  • Owner
  • Administrator
Using curl
curl https://www.zopim.com/api/v2/departments \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

[
  {
    "description": "A sample department",
    "enabled": 1,
    "id": 1,
    "members": [
      1,
      2,
      3
    ],
    "name": "Department 1",
    "settings": {}
  },
  {
    "description": "A sample department",
    "enabled": 0,
    "id": 2,
    "members": [
      4,
      5,
      6
    ],
    "name": "Department 2",
    "settings": {}
  }
]

Create Department

  • POST /api/v2/departments
Allowed for
  • Owner
  • Administrator
Using curl
curl https://www.zopim.com/api/v2/departments \
  -d '{
        "name" : "Department 1",
        "description" : "A sample department",
        "enabled" : 1,
        "members" : [1, 2, 3],
        "settings" : {}
      }' \
  -v -u {email_address}:{password} \
  -X POST -H "Content-Type: application/json"
Example Response
Status 201 Created

{
  "description": "A sample department",
  "enabled": 1,
  "id": 1,
  "members": [
    1,
    2,
    3
  ],
  "name": "Department 1",
  "settings": {}
}

Show Department by Name

  • GET /api/v2/departments/name/{department_name}
Allowed for
  • Owner
  • Administrator
Parameters
Name Type In Required Description
department_name string Path true The name of the department
Using curl
curl https://www.zopim.com/api/v2/departments/name/{department_name} \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "description": "A sample department",
  "enabled": 1,
  "id": 1,
  "members": [
    1,
    2,
    3
  ],
  "name": "Department 1",
  "settings": {}
}

Update Department by Name

  • PUT /api/v2/departments/name/{department_name}
Allowed for
  • Owner
  • Administrator
Parameters
Name Type In Required Description
department_name string Path true The name of the department
Using curl
curl https://www.zopim.com/api/v2/departments/name/{department_name} \
  -d '{"name": "Good department"}' \
  -v -u {email_address}:{password}
  -X PUT -H "Content-Type: application/json"
Example Response
Status 200 OK

{
  "description": "A sample department",
  "enabled": 1,
  "id": 1,
  "members": [
    1,
    2,
    3
  ],
  "name": "Good department",
  "settings": {}
}

Delete Department by Name

  • DELETE /api/v2/departments/name/{department_name}
Allowed for
  • Owner
  • Administrator
Parameters
Name Type In Required Description
department_name string Path true The name of the department
Using curl
curl https://www.zopim.com/api/v2/departments/name/{department_name} \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status 204 No Content

Show Department

  • GET /api/v2/departments/{department_id}
Allowed for
  • Owner
  • Administrator
Parameters
Name Type In Required Description
department_id integer Path true The ID of the department
Using curl
curl https://www.zopim.com/api/v2/departments/name/{name} \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "description": "A sample department",
  "enabled": 1,
  "id": 1,
  "members": [
    1,
    2,
    3
  ],
  "name": "Department 1",
  "settings": {}
}

Update Department

  • PUT /api/v2/departments/{department_id}
Allowed for
  • Owner
  • Administrator
Parameters
Name Type In Required Description
department_id integer Path true The ID of the department
Using curl
curl https://www.zopim.com/api/v2/departments/name/{department_id} \
  -d '{"name": "Good department"}' \
  -v -u {email_address}:{password}
  -X PUT -H "Content-Type: application/json"
Example Response
Status 200 OK

{
  "description": "A sample department",
  "enabled": 1,
  "id": 1,
  "members": [
    1,
    2,
    3
  ],
  "name": "Good department",
  "settings": {}
}

Delete Department

  • DELETE /api/v2/departments/{department_id}
Allowed for
  • Owner
  • Administrator
Parameters
Name Type In Required Description
department_id integer Path true The ID of the department
Using curl
curl https://www.zopim.com/api/v2/departments/{department_id} \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status 204 No Content