Contacts (contacts)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/addressbook/contacts

Creating a new contact

GET

/rest/v1/addressbook/contacts

Getting the list of contacts

GET

/rest/v1/addressbook/contacts/<id>

Getting contact data

PATCH

/rest/v1/addressbook/contacts/<id>

Modifying contact data

DELETE

/rest/v1/addressbook/contacts/<id>

Deleting a contact

LOOKUP

/rest/v1/addressbook/contacts

Searching for a contact identifier


Creating a new contact

Request

Field description: contact entity

Example request
POST /rest/v1/addressbook/contacts HTTP/1.1
Content-Type: application/json; charset=utf-8

contact entity

Response

Field description: contact entity

Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "ae425147-016c-d818-82d0-50e54938780c",
  "autokey": 1,
"displayname": "Mikhail Sidorov",
  "department": "IT",
  "jobtitle": "engineer",
  "number": "11",
  "numlocal": "411",
  "numpublic": "84950000000",
  "mobile": "8987000000",
  "mobile2": "",
  "mobile3": "",
  "roomnum": "2",
  "roomnum2": "",
  "roomnum3": "",
  "email": "",
  "email2": "",
  "email3": "",
  "photo": "",
  "opts": {
    "title": "",
    "comment": "",
    "groups": [],
    "priority": null
  },
  "ext": {
    "ct": "2019-08-28T11:59:40.75Z",
    "lwt": "2019-08-28T11:59:40.75Z"
  }
}

Getting the list of contacts

Request

Table 1. Request parameters
Name Type Description

filter

object

Filter by field values.

mask

str

List of fields to output. Available fields for output: id, autokey, displayname, department, jobtitle, number, email, opts.groups, opts.priority, ext.lwt, ext.ct.

offset

int

Offset in the list of resources to output.

limit

int

Maximum number of resources in the list.

order

array<object|str>

Sorting order of resources in the list.

flat

bool

Transformation of composite fields to flat form.

Example request
GET /rest/v1/addressbook/contacts?offset=0&limit=2 HTTP/1.1

Response

Field description: contact entity

Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "id": "ae425147-016c-d818-82d0-50e54938780c",
    "autokey": 1,
"displayname": "Mikhail Sidorov",

    "department": "IT",
    "jobtitle": "engineer",
    "number": "11",
    "email": "m.sidorov@company.com",
    "opts": {
      "groups": [
        "engineers"
      ],
      "priority": 100
    },
    "ext": {
      "ct": "2019-08-28T11:59:40.75Z",
      "lwt": "2019-08-29T07:57:58.40Z"
    }
  },
  {
    "id": "26d569b2-016c-d818-9e97-50e54938780c",
    "autokey": 2,

    "displayname": "Semyon Petrov",
    "department": "IT",
    "jobtitle": "engineer",
    "number": "12",
    "email": "s.petrov@company.com",
    "opts": {
      "groups": [],
      "priority": null
    },
    "ext": {
      "ct": "2019-08-28T11:59:47.86Z",
      "lwt": "2019-08-29T07:57:47.50Z"
    }
  }
]

Getting contact data

Request

Table 2. Request parameters
Name Type Description

mask

str

List of fields to output.

flat

bool

Transformation of composite fields to flat form.

Example request
GET /rest/v1/addressbook/contacts/ae425147-016c-d818-82d0-50e54938780c HTTP/1.1

Response

Field description: contact entity

Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "ae425147-016c-d818-82d0-50e54938780c",
  "autokey": 1,
"displayname": "Mikhail Sidorov",
  "department": "IT",
  "jobtitle": "engineer",
  "number": "11",
  "numlocal": "411",
  "numpublic": "84950000000",
  "mobile": "8987000000",
  "mobile2": "",
  "mobile3": "",
  "roomnum": "2",
  "roomnum2": "",
  "roomnum3": "",
  "email": "m.sidorov@company.com",
  "email2": "",
  "email3": "",
  "photo": "",
  "opts": {
    "title": "",
    "comment": "",
    "groups": [
      "engineers"
    ],
    "priority": 100
  },
  "ext": {
    "ct": "2019-08-28T11:59:40.75Z",
    "lwt": "2019-08-29T07:57:58.40Z"
  }
}

Modifying contact data

Fields prohibited for modification: id, autokey

Specifics

  • When the group composition changes, the link on the group side changes automatically.

Request

Field description: contact entity

Example request
PATCH /rest/v1/addressbook/contacts/ae425147-016c-d818-82d0-50e54938780c HTTP/1.1
Content-Type: application/json; charset=utf-8

contact entity

Response

Field description: contact entity

Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "id": "ae425147-016c-d818-82d0-50e54938780c",
  "autokey": 1,
"displayname": "Mikhail Sidorov",
  "department": "IT",
  "jobtitle": "engineer",
  "number": "11",
  "numlocal": "411",
  "numpublic": "84950000000",
  "mobile": "8987000000",
  "mobile2": "",
  "mobile3": "",
  "roomnum": "2",
  "roomnum2": "",
  "roomnum3": "",
  "email": "m.sidorov@company.com",
  "email2": "",
  "email3": "",
  "photo": "",
  "opts": {
    "title": "",
    "comment": "",
    "groups": [
      "engineers"
    ],
    "priority": 100
  },
  "ext": {
    "ct": "2019-08-28T11:59:40.75Z",
    "lwt": "2019-08-29T07:57:58.40Z"
  }
}

Deleting a contact

Request

Example request
DELETE /rest/v1/addressbook/contacts/ae425147-016c-d818-82d0-50e54938780c HTTP/1.1

Response

Example response
HTTP/1.1 204 No Content

Searching for a contact identifier

Searches for a resource by the specified key and returns the identifier(s) for building the endpoint.

Key fields for search: id, autokey, number

Request

Example request
LOOKUP /rest/v1/addressbook/contacts HTTP/1.1
Content-Type: application/json; charset=utf-8

"11"

Response

Example successful response
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

[
  "ae425147-016c-d818-82d0-50e54938780c"
]
Example failed response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8

{
  "error_code": 1404,
  "error_message": "Lookup failed"
}