Contact groups (contactgroups)

Requests

HTTP verb Endpoint Description

POST

/rest/v1/addressbook/contactgroups

Creating a new contact group

GET

/rest/v1/addressbook/contactgroups

Getting a list of contact groups

GET

/rest/v1/addressbook/contactgroups/<id>

Retrieving contact group data

PATCH

/rest/v1/addressbook/contactgroups/<id>

Changing contact group data

DELETE

/rest/v1/addressbook/contactgroups/<id>

Deleting a group of contacts

LOOKUP

/rest/v1/addressbook/contactgroups

Searching for a contact group ID


Creating a new contact group

Request

Field Description: contactgroup entity

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

contactgroup entity

Response

Field Description: contactgroup entity

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

{
  "id": "67f1f2df-016c-dc6b-5202-50e54938780c",
  "code": "101",
  "name": "group number 101",
  "shortname": "G.101",
  "opts": {
    "title": "",
    "comment": "",
    "abonents": [ 1, 5 ],
    "abonentcount": 2,
    "priority": 101
  },
  "ext": {
    "ct": "2019-08-29T08:08:32.60Z",
    "lwt": "2019-08-29T08:08:32.60Z"
  }
}

Getting a list of contact groups

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, code, name, shortname, opts.abonentcount, 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/contactgroups?offset=0&limit=2 HTTP/1.1

Response

Field Description: contactgroup entity

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

[
  {
    "id": "94cfb284-016c-dc6a-6823-50e54938780c",
    "code": "007",
    "name": "group number 007",
    "shortname": "G.007",
    "opts": {
      "abonentcount": 3,
      "priority": 1000
    },
    "ext": {
      "ct": "2019-08-29T08:07:36.24Z",
      "lwt": "2019-08-29T08:07:36.24Z"
    }
  },
  {
    "id": "67f1f2df-016c-dc6b-5202-50e54938780c",
    "code": "101",
    "name": "group number 101",
    "shortname": "G.101",
    "opts": {
      "abonentcount": 2,
      "priority": 101
    },
    "ext": {
      "ct": "2019-08-29T08:08:32.60Z",
      "lwt": "2019-08-29T08:08:32.60Z"
    }
  }
]

Retrieving contact group 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/contactgroups/67f1f2df-016c-dc6b-5202-50e54938780c HTTP/1.1

Response

Field Description: contactgroup entity

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

{
  "id": "67f1f2df-016c-dc6b-5202-50e54938780c",
  "code": "101",
  "name": "group number 101",
  "shortname": "G.101",
  "opts": {
    "title": "",
    "comment": "",
    "abonents": [ 1, 5 ],
    "abonentcount": 2,
    "priority": 101
  },
  "ext": {
    "ct": "2019-08-29T08:08:32.60Z",
    "lwt": "2019-08-29T08:08:32.60Z"
  }
}

Changing contact group data

Fields prohibited for modification: id

Features

  • When the contact composition is changed, the binding on the contact side changes automatically.

  • If the contact group code is changed, the associations between contacts and contact group are automatically rebuilt.

  • If the values of the name and shortname fields are the same before the change, then when the name field is changed without changing the shortname field, the content of the latter is automatically filled with content identical to the field name.

Request

Field Description: contactgroup entity

Request example
PATCH /rest/v1/addressbook/contactgroups/67f1f2df-016c-dc6b-5202-50e54938780c HTTP/1.1
Content-Type: application/json; charset=utf-8

contactgroup entity

Response

Field Description: contactgroup entity

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

{
  "id": "67f1f2df-016c-dc6b-5202-50e54938780c",
  "code": "101",
  "name": "group number 101",
  "shortname": "G.101",
  "opts": {
    "title": "",
    "comment": "",
    "abonents": [ 1, 5, 15, 27 ],
    "abonentcount": 4,
    "priority": 98
  },
  "ext": {
    "ct": "2019-08-29T08:08:32.60Z",
    "lwt": "2019-09-06T16:22:07.54Z"
  }
}

Deleting a group of contacts

Request

Request example
DELETE /rest/v1/addressbook/contactgroups/67f1f2df-016c-dc6b-5202-50e54938780c HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Searching for a contact group ID

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

Key fields to search for: id, code

Request

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

"101"

Response

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

[
  "67f1f2df-016c-dc6b-5202-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"
}