OMNIDESK API
Сотрудники
Создание сотрудника

POST  |  https://[domain].omnidesk.ru/api/staff.json
Добавление нового сотрудника.
Параметры
Запрос

{
  "staff" : {
    "staff_email" : "staff@domain.ru",
    "staff_full_name" : "Staff full name",
    "staff_signature" : "Staff signature"
  }
}
Ответ

{
  "staff" : {
    "staff_id" : 200,
    "staff_email" : "staff@domain.ru",
    "staff_full_name" : "Staff full name",
    "staff_signature" : "Staff signature",
    "thumbnail" : "",
    "active" : false,
    "created_at" : Mon, 05 May 2014 00:15:17 +0300,
    "updated_at" : Tue, 23 Dec 2014 10:55:23 +0200
  }
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X POST -d '{ "staff": { "staff_email":"staff@domain.ru", "staff_full_name":"Staff full name", "staff_signature":"Staff signature" }}' https://[domain].omnidesk.ru/api/staff.json
Получение списка сотрудников

GET  |  https://[domain].omnidesk.ru/api/staff.json
Просмотр списка сотрудников.
Параметры
Ответ

{
    "0" : {
      "staff" : {
        "staff_id" : 200,
        "staff_email" : "staff@domain.ru",
        "staff_full_name" : "Staff full name",
        "staff_signature" : "Staff signature",
        "thumbnail" : "",
        "active" : false,
        "status" : "online",
        "status_id": 1,
        "created_at" : Mon, 05 May 2014 00:15:17 +0300,
        "updated_at" : Tue, 23 Dec 2014 10:55:23 +0200
      }
    },
    "1" : {
      "staff" : {
        "staff_id" : 210,
        "staff_email" : "staff2@domain.ru",
        "staff_full_name" : "Staff 2 full name",
        "staff_signature" : "Staff 2 signature",
        "thumbnail" : "http://[domain].omnidesk.ru/path/avatar.jpeg",
        "active" : true,
        "status" : "offline",
        "status_id": 2,
        "created_at" : Mon, 05 May 2014 00:15:17 +0300,
        "updated_at" : Tue, 23 Dec 2014 10:55:23 +0200
      }
    },
    "total_count":10
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].omnidesk.ru/api/staff.json?limit=50&page=2
Получение списка ролей сотрудников

GET  |  https://[domain].omnidesk.ru/api/staff_roles.json
Просмотр списка ролей сотрудников.
Ответ

{
    "0": {
        "staff_roles": {
            "role_id": 3,
            "role": "Первая линия поддержки"
        }
    },
    "1": {
        "staff_roles": {
            "role_id": 9,
            "role": "Вторая линия поддержки"
        }
    },
    "2": {
        "staff_roles": {
            "role_id": 53,
            "role": "Руководство"
        }
    },
    "count": 3
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].omnidesk.ru/api/staff_roles.json
Получение списка статусов сотрудников

GET  |  https://[domain].omnidesk.ru/api/staff_statuses.json
Просмотр списка статусов сотрудников.
Ответ

{
    "0": {
        "staff_statuses": {
            "status_id": 1,
            "status": "Онлайн",
            "active": true
        }
    },
    "1": {
        "staff_statuses": {
            "status_id": 3,
            "status": "Без чатов",
            "active": true
        }
    },
    "2": {
        "staff_statuses": {
            "status_id": 113808,
            "status": "Обучение",
            "active": false
        }
    },
    "3": {
        "staff_statuses": {
            "status_id": 120273,
            "status": "Обед",
            "active": false
        }
    },
    "4": {
        "staff_statuses": {
            "status_id": 2,
            "status": "Офлайн",
            "active": true
        }
    },
    "count": 5
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].omnidesk.ru/api/staff_statuses.json
Просмотр сотрудника

GET  |  https://[domain].omnidesk.ru/api/staff/[id].json
Просмотр данных конкретного сотрудника.
Ответ

{
  "staff" : {
    "staff_id" : 200,
    "staff_email" : "staff@domain.ru",
    "staff_full_name" : "Staff full name",
    "staff_signature" : "Staff signature",
    "thumbnail" : "",
    "active" : false,
    "status" : "online",
    "status_id": 1,
    "created_at" : Mon, 05 May 2014 00:15:17 +0300,
    "updated_at" : Tue, 23 Dec 2014 10:55:23 +0200
  }
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].omnidesk.ru/api/staff/200.json
Редактирование сотрудника

PUT  |  https://[domain].omnidesk.ru/api/staff/[id].json
Изменение данных конкретного сотрудника.
Параметры
Запрос

{
  "staff" : {
    "staff_full_name" : "Staff full name changed"
  }
}
Ответ

{
  "staff" : {
    "staff_id" : 200,
    "staff_email" : "staff@domain.ru",
    "staff_full_name" : "Staff full name changed",
    "staff_signature" : "Staff signature",
    "thumbnail" : "",
    "active" : false,
    "created_at" : Mon, 05 May 2014 00:15:17 +0300,
    "updated_at" : Tue, 23 Dec 2014 10:55:23 +0200
  }
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '{ "staff": { "staff_full_name":"Staff full name changed" }}' https://[domain].omnidesk.ru/api/staff/200.json
Выключение сотрудника

PUT  |  https://[domain].omnidesk.ru/api/staff/[id]/disable.json
Отключение сотрудника.
Параметры
Запрос

{
  "staff" : {
    "replace_staff_id" : 300
  }
}
Ответ

{
  "staff" : {
    "staff_id" : 200,
    "staff_email" : "staff@domain.ru",
    "staff_full_name" : "Staff full name changed",
    "staff_signature" : "Staff signature",
    "active" : false,
    "created_at" : Mon, 05 May 2014 00:15:17 +0300,
    "updated_at" : Tue, 23 Dec 2014 10:55:23 +0200
  }
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '{ "staff": { "replace_staff_id":"300" }}' https://[domain].omnidesk.ru/api/staff/200/disable.json
Включение сотрудника

PUT  |  https://[domain].omnidesk.ru/api/staff/[id]/enable.json
Включение сотрудника.
Ответ

{
  "staff" : {
    "staff_id" : 200,
    "staff_email" : "staff@domain.ru",
    "staff_full_name" : "Staff full name changed",
    "staff_signature" : "Staff signature",
    "active" : true,
    "created_at" : Mon, 05 May 2014 00:15:17 +0300,
    "updated_at" : Tue, 23 Dec 2014 10:55:23 +0200
  }
}
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].omnidesk.ru/api/staff/200/enable.json
Удаление сотрудника

DELETE  |  https://[domain].omnidesk.ru/api/staff/[id].json
Удаление сотрудника.
Параметры
Запрос

{
  "staff" : {
    "replace_staff_id" : 300
  }
}
Ответ

HTTP Status: 200 OK
Пример кода

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X DELETE https://[domain].omnidesk.ru/api/staff/200.json