[comment]: # translation:outdated

[comment]: # ({8e76cf8c-8e76cf8c})
# 获取

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

[comment]: # ({9c312875-04265e54})
### 描述

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

此方法允许根据给定参数来获取图标映射。

::: noteclassic
此方法仅允许*超级管理员*类型的用户使用。
调用此方法的权限可以在用户角色设置里撤销。更多信息请参见[用户角色](/manual/web_interface/frontend_sections/administration/user_roles)。
:::

[comment]: # ({/9c312875-04265e54})

[comment]: # ({fc4d18ff-efcde208})

### 参数

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

该方法支持如下参数。

|参数|[类型](/manual/api/reference_commentary#data_types)|描述|
|---------|---------------------------------------------------|-----------|
|iconmapids|string/array|只返回具有给定id的图标映射。|
|sysmapids|string/array|只返回在给定映射中使用的图标映射。|
|selectMappings|query|Return a [mappings](/manual/api/reference/iconmap/object#icon_mapping) property with the icon mappings used.|
|sortfield|string/array|根据给定的属性对结果进行排序。<br><br>可选值: `iconmapid` 和 `name`。|
|countOutput|boolean|这些参数对于所有的“get”方法都是通用的，详细描述请参见 [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]: # ({/fc4d18ff-efcde208})

[comment]: # ({7223bab1-7223bab1})
### 返回值

`(整数/数组)` 返回任一：

-   对象数组；
-   如果已使用countOutput参数，则检索对象的计数。

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

[comment]: # ({b41637d2-b41637d2})
### 例如

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

[comment]: # ({3f110d3e-016ff9fc})
#### 检索图标映射

检索所有关于图标映射 "3"的数据。

请求：

```json
{
    "jsonrpc": "2.0",
    "method": "iconmap.get",
    "params": {
        "iconmapids": "3",
        "output": "extend",
        "selectMappings": "extend"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

响应

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "mappings": [
                {
                    "iconmappingid": "3",
                    "iconmapid": "3",
                    "iconid": "6",
                    "inventory_link": "1",
                    "expression": "server",
                    "sortorder": "0"
                },
                {
                    "iconmappingid": "4",
                    "iconmapid": "3",
                    "iconid": "10",
                    "inventory_link": "1",
                    "expression": "switch",
                    "sortorder": "1"
                }
            ],
            "iconmapid": "3",
            "name": "Host type icons",
            "default_iconid": "2"
        }
    ],
    "id": 1
}
```

[comment]: # ({/3f110d3e-016ff9fc})

[comment]: # ({8df05cf6-8df05cf6})

### 参见

-   [图标映射](object#icon_mapping)

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

[comment]: # ({2420d0f0-2420d0f0})

### 来源

CIconMap::get() in *ui/include/classes/api/services/CIconMap.php*.

[comment]: # ({/2420d0f0-2420d0f0})
