update_data_flags

To add items to a session or delete them from it, use the core/update_data_flags method. Add items to a session to receive events from them.

Endpoint

Copied!
svc=core/update_data_flags&params={
  "spec": [
    {
      "type": "<text>",
      "data": <long|text|[long]>,
      "flags": <long>,
      "mode": <uint>,
      "max_items": <uint>
    }
  ]
}

Parameters

The request must contain the following parameters:

Parameter Description
spec An array of objects. Each object describes which items to change in the session and how.
type The way to specify items:
  • id: by ID. Specify the item ID in the data parameter.
  • type: by type. Specify the type of items in the data parameter (see core/search_items).
  • col: by a list of IDs. Specify an array of item IDs in the data parameter.
  • access: subscription to events about creating and deleting items, and about getting and losing access rights to them. In the data parameter, specify 1 to enable or 0 to disable.
data Data. Depends on the type parameter.
flags The flags that define what information about items to add to the session. The item flags of each type are described in the Data format section.
mode The flag application mode:
  • 0: redefine flags for the specified items.
  • 1: add the specified flags to the existing ones in the session.
  • 2: delete the specified flags from the session. When you delete the basic flag, the item is deleted from the session.
The flags define which item properties to monitor. Specify the flags you need; to receive all events, specify all flags. To receive the events, use the avl_evts method.
max_items The maximum number of subscribed items. Available only if type is type.

Response

If the request is completed successfully, the response is returned in the following format:

Copied!
[             /* Array of items. */
  {
    "i": <long>,  /* ID. */
    "d": {        /* Other fields. */
      ...
    },
    "f": <long>   /* Applied flags. */
  },
  ...
]

The d field format depends on the returned item type. d is null if the request adds no new flags (for example, mode 2); items whose flags don’t change are omitted. The formats of all item types are described in the Data format section.

If the session has a limit on the number of message parameters, the request returns the unit parameters each time you add the flag of message parameters in mode 1. For details, see Limited list of parameters.

If the request fails, an error code is returned.

Error codes

Error code Description
1 Invalid session.
4 Wrong input parameters or error updating flags.

If you find a mistake in the text, please select it and press Ctrl+Enter.