Zabbix Documentation 2.2

3.04.04.45.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


manual:api:reference:mediatype:get

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Previous revision
manual:api:reference:mediatype:get [2014/09/26 11:23]
manual:api:reference:mediatype:get [2019/01/28 14:49] (current)
sasha <code js> => <code java>
Line 1: Line 1:
 +===== mediatype.get =====
  
 +==== Description ====
 +
 +''​integer/​array mediatype.get(object **parameters**)''​
 +
 +The method allows to retrieve media types according to the given parameters.
 +
 +==== Parameters ====
 +
 +''​(object)''​ Parameters defining the desired output.
 +
 +The method supports the following parameters.
 +
 +^ Parameter ^ Type ^ Description ^
 +| mediatypeids | string/​array | Return only media types with the given IDs. |
 +| mediaids | string/​array | Return only media types used by the given media. |
 +| userids | string/​array | Return only media types used by the given users. |
 +^ |||
 +| selectUsers | query | Return the users that use the media type in the ''​users''​ property. |
 +^ |||
 +| sortfield | string/​array | Sort the result by the given properties. \\ \\ Possible values are: ''​mediatypeid''​. ​ |
 +| countOutput |flag|These parameters being common for all ''​get''​ methods are described in detail in the [[manual:​api:​reference_commentary#​common_get_method_parameters|reference commentary]]. ​ |
 +| editable |boolean|:::​|
 +| excludeSearch |flag|:::|
 +| filter | object |:::|
 +| limit |integer|:::​|
 +| nodeids |string/​array|:::​|
 +| output |query|:::|
 +| preservekeys |flag|:::|
 +| search | object |:::|
 +| searchByAny |boolean|:::​|
 +| searchWildcardsEnabled |boolean|:::​|
 +| sortorder | string/​array | ::: |
 +| startSearch |flag|:::|
 +==== Return values ====
 +
 +''​(integer/​array)''​ Returns either:
 +  * an array of objects;
 +  * the count of retrieved objects, if the ''​countOutput''​ parameter has been used.
 +
 +==== Examples ====
 +
 +=== Retrieving media types ===
 +
 +Retrieve all configured media types.
 +
 +Request:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​mediatype.get",​
 +    "​params":​ {
 +        "​output":​ "​extend"​
 +    },
 +    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ [
 +        {
 +            "​mediatypeid":​ "​1",​
 +            "​type":​ "​0",​
 +            "​description":​ "​Email",​
 +            "​smtp_server":​ "​mail.company.com",​
 +            "​smtp_helo":​ "​company.com",​
 +            "​smtp_email":​ "​[email protected]",​
 +            "​exec_path":​ "",​
 +            "​gsm_modem":​ "",​
 +            "​username":​ "",​
 +            "​passwd":​ "",​
 +            "​status":​ "​0"​
 +        },
 +        {
 +            "​mediatypeid":​ "​2",​
 +            "​type":​ "​3",​
 +            "​description":​ "​Jabber",​
 +            "​smtp_server":​ "",​
 +            "​smtp_helo":​ "",​
 +            "​smtp_email":​ "",​
 +            "​exec_path":​ "",​
 +            "​gsm_modem":​ "",​
 +            "​username":​ "​[email protected]",​
 +            "​passwd":​ "​zabbix",​
 +            "​status":​ "​0"​
 +        },
 +        {
 +            "​mediatypeid":​ "​3",​
 +            "​type":​ "​2",​
 +            "​description":​ "​SMS",​
 +            "​smtp_server":​ "",​
 +            "​smtp_helo":​ "",​
 +            "​smtp_email":​ "",​
 +            "​exec_path":​ "",​
 +            "​gsm_modem":​ "/​dev/​ttyS0",​
 +            "​username":​ "",​
 +            "​passwd":​ "",​
 +            "​status":​ "​0"​
 +        }
 +    ],
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +==== See also ====
 +
 +  * [[manual:​api:​reference:​user:​object#​user|User]]
 +
 +==== Source ====
 +
 +CMediaType::​get() in //​frontends/​php/​api/​classes/​CMediaType.php//​.