Contacts (contacts)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/addressbook/contacts

Creating a new contact

GET

/rest/v1/addressbook/contacts

Getting a list of contacts

GET

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

Retrieving contact data

PATCH

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

Changing contact data

DELETE

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

Deleting a contact

LOOKUP

/rest/v1/addressbook/contacts

Searching for a contact ID


Creating a new contact

Request

Field Description: contact entity

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

contact entity

Response

Field Description: contact entity

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

{
  "id": "ae425147-016c-d818-82d0-50e54938780c",
  "autokey": 1,
  "displayname": "John Smith",
  "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 a 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 be issued.

limit

int

The maximum number of resources in the list.

order

array<object|str>

The sort order of the resources in the list.

flat

bool

Conversion to flat form of composite fields.

Request example
GET /rest/v1/addressbook/contacts?offset=0&limit=2 HTTP/1.1

Response

Field Description: contact entity

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

[
  {
    "id": "ae425147-016c-d818-82d0-50e54938780c",
    "autokey": 1,
    "displayname": "John Smith",
    "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": "Adam White",
    "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"
    }
  }
]

Retrieving contact data

Request

Table 2. Request parameters
Name Type Description

mask

str

A list of fields to output.

flat

bool

Conversion to flat form of composite fields.

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

Response

Field Description: contact entity

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

{
  "id": "ae425147-016c-d818-82d0-50e54938780c",
  "autokey": 1,
  "displayname": "John Smith",
  "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"
  }
}

Changing contact data

Fields prohibited for modification: id, autokey

Features

  • When the group composition changes, the group-side bindings change automatically.

Request

Field Description: contact entity

Request example
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

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

{
  "id": "ae425147-016c-d818-82d0-50e54938780c",
  "autokey": 1,
  "displayname": "John Smith",
  "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

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

Response

Response example
HTTP/1.1 204 No Content

Searching for a contact ID

Searches the resource for the specified key, returns the identifier(s) to build the endpoint.

Key fields to search for: id, autokey, number

Request

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

"11"

Response

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

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

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