user.updatemedia

Description

object user.updatemedia(object parameters)

This method allows to update media for multiple users.

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

Parameters

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

Parameter Type Description
medias(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(required) object/array Users to update. 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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "user.updatemedia",
  4. "params": {
  5. "users": [
  6. {
  7. "userid": "1"
  8. },
  9. {
  10. "userid": "2"
  11. }
  12. ],
  13. "medias": {
  14. "mediatypeid": "1",
  15. "sendto": "[email protected]",
  16. "active": 0,
  17. "severity": 63,
  18. "period": "1-7,00:00-24:00"
  19. }
  20. },
  21. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  22. "id": 1
  23. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "userids": [
  5. "1",
  6. "2"
  7. ]
  8. },
  9. "id": 1
  10. }

See also

Source

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