[comment]: # ({8e685c26-8e685c26})
# valuemap.get

[comment]: # ({/8e685c26-8e685c26})

[comment]: # ({1341dac8-e4af27c5})
### 说明

`integer/array valuemap.get(object parameters)`

该方法允许根据给定的参数来检索值映射。

[comment]: # ({/1341dac8-e4af27c5})

[comment]: # ({e4af27c5-8c5348bd})
### Description

`integer/array valuemap.get(object parameters)`

The method allows to retrieve value maps according to the given
parameters.

[comment]: # ({/e4af27c5-8c5348bd})

[comment]: # ({beda388c-7223bab1})
### 参数

`(object)` 定义所需输出的参数。

该方法支持以下参数。

|属性                     类|说明|<|
|------------------------------|------|-|
|valuemapids|string/array|只返回具有给定ID的值映射。|
|selectMappings|query|在“映射”属性中返回当前值映射的值映射。|
|sortfield|string/array|按照给定的属性对结果进行排序。<br><br>可能的值为：`valuemapid`，`name`。|
|countOutput|flag|这些参数对于所有的“get”方法是常见的，在[参考评论](/manual/api/reference_commentary#common_get_method_parameters)中有详细描述.|
|editable|boolean|^|
|excludeSearch|flag|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|flag|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|flag|^|

[comment]: # ({/beda388c-7223bab1})

[comment]: # ({b6525fa2-b41637d2})
### Return values

`(integer/array)` Returns either:

-   an array of objects;
-   the count of retrieved objects, if the `countOutput` parameter has
    been used.

```{=html}
<!-- -->
```
    * 

[comment]: # ({/b6525fa2-b41637d2})

[comment]: # ({b991e8dd-9b18e57c})
### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|Type|Description|
|---------|----|-----------|
|valuemapids|string/array|Return only value maps with the given IDs.|
|selectMappings|query|Return the value mappings for current value map in the `mappings` property.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values are: `valuemapid`, `name`.|
|countOutput|boolean|These parameters being common for all `get` methods are described in detail in the [reference commentary](/manual/api/reference_commentary#common_get_method_parameters).|
|editable|boolean|^|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/b991e8dd-9b18e57c})

[comment]: # ({b2ca9376-42a7f9d6})
### Return values

`(integer/array)` Returns either:

-   an array of objects;
-   the count of retrieved objects, if the `countOutput` parameter has
    been used.

### 示例

### Examples

#### Retrieving value maps

Retrieve all configured value maps.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "valuemap.get",
    "params": {
        "output": "extend"
    },
    "auth": "57562fd409b3b3b9a4d916d45207bbcb",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": [
        {
            "valuemapid": "4",
            "name": "APC Battery Replacement Status"
        },
        {
            "valuemapid": "5",
            "name": "APC Battery Status"
        },
        {
            "valuemapid": "7",
            "name": "Dell Open Manage System Status"
        }
    ],
    "id": 1
}
```

Retrieve one value map with its mappings.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "valuemap.get",
    "params": {
        "output": "extend",
        "selectMappings": "extend",
        "valuemapids": ["4"]
    },
    "auth": "57562fd409b3b3b9a4d916d45207bbcb",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": [
        {
            "valuemapid": "4",
            "name": "APC Battery Replacement Status",
            "mappings": [
                {
                    "value": "1",
                    "newvalue": "unknown"
                },
                {
                    "value": "2",
                    "newvalue": "notInstalled"
                },
                {
                    "value": "3",
                    "newvalue": "ok"
                },
                {
                    "value": "4",
                    "newvalue": "failed"
                },
                {
                    "value": "5",
                    "newvalue": "highTemperature"
                },
                {
                    "value": "6",
                    "newvalue": "replaceImmediately"
                },
                {
                    "value": "7",
                    "newvalue": "lowCapacity"
                }
            ]
        }
    ],
    "id": 1
}
```

### 来源

### Source

CValueMap::get() in
*frontends/php/include/classes/api/services/CValueMap.php*.

[comment]: # ({/b2ca9376-42a7f9d6})
