OMNIDESK API
Пользователи
Создание пользователя
POST  |  https://[domain].omnidesk.ru/api/users.json
Добавление нового пользователя.
Параметры
Запрос
{
  "user" : {
    "user_email" : "user@domain.ru",
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "user_note" : "Some note",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    }
  }
}
Ответ
{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "password" : "bsdegs",
    "type" : "email",
    "user_email" : "user@domain.ru",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    },
    "linked_users" : [123,456]
  }
}
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X POST -d '{ "user": { "user_email":"user@domain.ru", "user_full_name":"User\u0027s full name", "language_id":2, "custom_fields":{"cf_20":"some data", "cf_23":true} }}' https://[domain].omnidesk.ru/api/users.json
Получение списка пользователей
GET  |  https://[domain].omnidesk.ru/api/users.json
Просмотр списка пользователей.

Если в запросе не указывать параметры page и limit, то в результате отобразятся первые сто пользователей.
Параметры
Ответ
{
    "0": {
      "user" : {
        "user_id" : 200,
        "user_full_name" : "User's full name",
        "company_name" : "User's company name",
        "company_position" : "User's position",
        "thumbnail" : "",
        "confirmed" : false,
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "type" : "email",
        "user_email" : "user@domain.ru",
        "language_id" : 2,
        "custom_fields" : {
            "cf_20" : "some data",
            "cf_23" : true,
        }
      }
    },
    "1": {
      "user" : {
        "user_id" : 300,
        "user_full_name" : "Second user's full name",
        "company_name" : "Second user's company name",
        "company_position" : "Second user's position",
        "thumbnail" : "",
        "confirmed" : false,
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "type" : "facebook",
        "facebook_id" : 123123123,
        "language_id" : 2,
        "custom_fields" : {
            "cf_20" : "some data",
            "cf_23" : true,
        }
      }
    },
    "2": {
      "user" : {
        "user_id" : 400,
        "user_full_name" : "Third user's full name",
        "company_name" : "Third user's company name",
        "company_position" : "Third user's position",
        "thumbnail" : "",
        "confirmed" : false,
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "type" : "twitter",
        "facebook_id" : 3333333,
        "language_id" : 1,
        "custom_fields" : {
            "cf_20" : "some data",
            "cf_23" : true,
        }
      }
    },
    "total_count":20
}
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -g -X GET "https://[domain].omnidesk.ru/api/users.json?limit=50&page=2&language_id=2&custom_fields[cf_20]=data"
Просмотр пользователя
GET  |  https://[domain].omnidesk.ru/api/users/[id].json
Просмотр данных конкретного пользователя.
Ответ
{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "user@domain.ru",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    },
    "linked_users" : [123,456]
  }
}
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].omnidesk.ru/api/users/200.json
Редактирование пользователя
PUT  |  https://[domain].omnidesk.ru/api/users/[id].json
Изменение данных конкретного пользователя.
Параметры
Запрос
{
  "user" : {
    "user_full_name" : "User's full name changed",
    "language_id" : 1,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    }
  }
}
Ответ
{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "user@domain.ru",
    "language_id" : 1,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    }
  }
}
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '{ "user": { "user_full_name":"User\u0027s full name changed", "language_id":2, "custom_fields":{"cf_20":"some data", "cf_23":true} }}' https://[domain].omnidesk.ru/api/users/200.json
Удаление пользователя
PUT  |  https://[domain].omnidesk.ru/api/users/[id]/disable.json
Удаление пользователя. В этом случае пользователь переносится в список удалённых и при необходимости его можно восстановить.
Ответ
{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : true,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "user@domain.ru",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    }
  }
}
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].omnidesk.ru/api/users/200/disable.json
Блокирование пользователя
PUT  |  https://[domain].omnidesk.ru/api/users/[id]/block.json
Блокирование пользователя. Все последующие обращения пользователя автоматически попадают в спам.
Ответ
{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : false,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "user@domain.ru",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    }
  }
}
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].omnidesk.ru/api/users/200/block.json
Восстановление пользователя
PUT  |  https://[domain].omnidesk.ru/api/users/[id]/restore.json
Включение пользователя после блокировки или восстановление после удаления.
Ответ
{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "user@domain.ru",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true,
    }
  }
}
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].omnidesk.ru/api/users/200/restore.json
Полное удаление пользователя
DELETE  |  https://[domain].omnidesk.ru/api/users/[id].json
Безвозвратное удаление пользователя. Доступно только для сотрудников с полным доступом.
Ответ
HTTP Status: 200 OK
Пример кода
curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X DELETE https://[domain].omnidesk.ru/api/users/200.json