Ad Widget

Collapse

API: user.get, selectMedias - why can't filter by medias property?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tikkami
    Member
    • May 2018
    • 71

    #1

    API: user.get, selectMedias - why can't filter by medias property?

    Hi

    I have tried to filter users by media property.

    It seems that filtering does not work with selectMedias properties. Filtering works if I try to apply filter to user's properties.
    Am I doing something wrong or should filtering by media property work at all?
    (At least this kind of filtering is working for example with host.get, selectInterfaces, so I thought this may work also with user.get..)

    Look at example below. I tried to apply filter "active": "1".
    However, that filter is not applied to the response.

    Tested with Zabbix 4.0.0 and 4.0.14.

    ===> ===> ===>
    {
    "jsonrpc": "2.0",
    "method": "user.get",
    "params": {
    "output": [
    "alias"
    ],
    "selectMedias": "extend",
    "filter": {
    "active": "1"
    }

    },
    "id": 2,
    "auth": "81437cdd86cf645733496439602fc725"
    }

    <=== <=== <===
    {
    "jsonrpc": "2.0",
    "result": [
    {
    "userid": "1",
    "alias": "Admin",
    "medias": [
    {
    "mediaid": "1",
    "userid": "1",
    "mediatypeid": "1",
    "sendto": [
    "[email protected]"
    ],
    "active": "0",
    "severity": "63",
    "period": "1-7,00:00-24:00"
    }
    ]
    },
    {
    "userid": "2",
    "alias": "guest",
    "medias": []
    }
    ],
    "id": 2
    }




    This is the case where filtering does work.
    ===> ===> ===>
    {
    "jsonrpc": "2.0",
    "method": "user.get",
    "params": {
    "output": [
    "alias"
    ],
    "selectMedias": "extend",
    "filter": {
    "userid": "1"
    }

    },
    "id": 2,
    "auth": "5c3cf302ddd1241d5ae834726673cf84"
    }

    <=== <=== <===
    {
    "jsonrpc": "2.0",
    "result": [
    {
    "userid": "1",
    "alias": "Admin",
    "medias": [
    {
    "mediaid": "1",
    "userid": "1",
    "mediatypeid": "1",
    "sendto": [
    "[email protected]"
    ],
    "active": "0",
    "severity": "63",
    "period": "1-7,00:00-24:00"
    }
    ]
    }
    ],
    "id": 2
    }


Working...