# user.updatemedia

### Description

`object user.updatemedia(object parameters)`

This method allows to update media for multiple users.

::: notewarning
This method is deprecated and will be removed in the
future. Please use [user.update](update) instead.
:::

### Parameters

`(object)` Parameters defining the media and users to be updated.

|Parameter|Type|Description|
|---------|----|-----------|
|**medias**<br>(required)|object/array|Media to replace existing media. If a media has the `mediaid` property defined it will be updated, otherwise a new media will be created.|
|**users**<br>(required)|object/array|Users to update.<br><br>The users must have the `userid` property defined.|

### Return values

`(object)` Returns an object containing the IDs of the updated users
under the `userids` property.

### Examples

#### Replacing media for multiple users

Replace all media used by the two users with a common e-mail media. The
media must send notifications about all alerts at any time.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "user.updatemedia",
    "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
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "userids": [
            "1",
            "2"
        ]
    },
    "id": 1
}
```

### See also

-   [user.addmedia](addmedia)
-   [user.deletemedia](deletemedia)
-   [user.updatemedia](updatemedia)
-   [Media](/manual/api/reference/usermedia/object#media)
-   [User](object#user)

### Source

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