manual:api:reference:valuemap:create

Differences

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

Link to this comparison view

Next revision
Previous revision
manual:api:reference:valuemap:create [2015/10/20 09:33]
iivs created valuemap.create method page
manual:api:reference:valuemap:create [2021/05/05 14:13]
gcalenko [ZBXNEXT-114,ZBXNEXT-6572] updated valuemap.create example
Line 5: Line 5:
  
 This method allows to create new value maps. This method allows to create new value maps.
 +
 +<​note>​This method is only available to //Super admin// user type. Permissions to call the method can be revoked in user role settings. See [[:​manual/​web_interface/​frontend_sections/​administration/​user_roles|User roles]] for more information.</​note>​
  
 ==== Parameters ==== ==== Parameters ====
 +
 ''​(object/​array)''​ Value maps to create. ''​(object/​array)''​ Value maps to create.
  
-The method accepts value maps with with the [[object#​value_map|standard value map properties]].+The method accepts value maps with the [[object#​value_map|standard value map properties]].
  
 ==== Return values ==== ==== Return values ====
Line 20: Line 23:
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
     "​method":​ "​valuemap.create",​     "​method":​ "​valuemap.create",​
     "​params":​ {     "​params":​ {
 +        "​hostid":​ "​50009",​
         "​name":​ "​Service state",​         "​name":​ "​Service state",​
         "​mappings":​ [         "​mappings":​ [
             {             {
-                "value": "0", +                "type": "1",
-                "​newvalue":​ "​Down"​ +
-            }, +
-            {+
                 "​value":​ "​1",​                 "​value":​ "​1",​
                 "​newvalue":​ "​Up"​                 "​newvalue":​ "​Up"​
 +            },
 +            {
 +                "​type":​ "​5",​
 +                "​newvalue":​ "​Down"​
             }             }
         ]         ]
Line 43: Line 48:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 57: Line 62:
 ==== Source ==== ==== Source ====
  
-CValueMap::​create() in //frontends/​php/​include/​classes/​api/​services/​CValueMap.php//​.+CValueMap::​create() in //ui/​include/​classes/​api/​services/​CValueMap.php//​.