Departments

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

JSON Format

Departments are represented as JSON objects with the following attributes.

Name Type Read-only Description
id integer yes The ID of the department
name string no The name of the department
description string no The description of the department
enabled integer no Describes whether the department is enabled
members array no The member agent IDs for the account
settings object no The settings for the department

Get All Departments

GET /api/v2/departments

Lists 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
HTTP/1.1 200 OK
Content-Type: application/json

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

Get Department by ID

GET /api/v2/departments/{department_id}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/departments/{department_id} \
  -v -u {email_address}:{password}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json

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

Get Department by Name

GET /api/v2/departments/name/{name}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/departments/name/{name} \
  -v -u {email_address}:{password}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id" : 1,
  "name" : "Department 1",
  "description" : "A sample department",
  "enabled" : 1,
  "members" : [1, 2, 3],
  "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
HTTP/1.1 201 Created
Content-Type: application/json

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

Update Department by ID

PUT /api/v2/departments/{department_id}

Allowed for
  • Owner
  • Administrator
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
HTTP/1.1 200 OK
Content-Type: application/json

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

Update Department by Name

PUT /api/v2/departments/name/{name}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/departments/name/{name} \
  -d '{"name": "Good department"}' \
  -v -u {email_address}:{password}
  -X PUT -H "Content-Type: application/json"
Example Response
HTTP/1.1 200 OK
Content-Type: application/json

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

Delete Department by ID

DELETE /api/v2/departments/{department_id}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/departments/{department_id} \
  -v -u {email_address}:{password} -X DELETE
Response
Status: 204 No Content

Delete Department by Name

DELETE /api/v2/departments/name/{name}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/departments/name/{name} \
  -v -u {email_address}:{password} -X DELETE
Response
Status: 204 No Content