This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

user.addmedia

Description

object user.addmedia(object parameters)

This method allows to add new media to multiple users.

This method is deprecated and will be removed in the future. Please use user.update instead.

Parameters

(object) Parameters defining the media to create and the users to add them to.

Parameter Type Description
medias
(required)
object/array Media to create for the given users.

The media userid property must not be defined.
users
(required)
object/array Users to add the media to.

The users must have the userid property defined.

Return values

(object) Returns an object containing the IDs of the created media under the mediaids property.

Examples

Adding a media to multiple users

Create a common e-mail media for two users. The media must send notifications about all alerts at any time.

Request:

{
           "jsonrpc": "2.0",
           "method": "user.addmedia",
           "params": {
               "users": [
                   {
                       "userid": "1"
                   },
                   {
                       "userid": "2"
                   }
               ],
               "medias": {
                   "mediatypeid": "1",
                   "sendto": "support@company.com",
                   "active": 0,
                   "severity": 63,
                   "period": "1-7,00:00-24:00"
               }
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }
Copy
✔ Copied

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "mediaids": [
                   "12",
                   "13"
               ]
           },
           "id": 1
       }
Copy
✔ Copied

See also

Source

CUser::addMedia() in frontends/php/include/classes/api/services/CUser.php.

To toggle search highlight, press Ctrl+Alt+H
Have an improvement suggestion for this page? Select the text that could be improved and press Ctrl+Enter to send it to the editors.