[comment]: # ({34f25b55-34f25b55})
# apiinfo.version

[comment]: # ({/34f25b55-34f25b55})

[comment]: # ({bc32199a-bc32199a})
### 描述

`string apiinfo.version(array)`

此方法允许获取Zabbix API的version功能。

::: noteimportant
此方法仅对未认证用户可用
且必须在JSON-RPC请求中不包含`auth`参数的情况下调用。

:::

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

[comment]: # ({4fa8a419-4fa8a419})
### 参数

`(array)` 该方法接受一个空的array。

[comment]: # ({/4fa8a419-4fa8a419})

[comment]: # ({53521d11-53521d11})
### 返回值

`(string)` 返回Zabbix API的version.

::: notetip
从Zabbix 2.0.4开始，API的version
与Zabbix的version相匹配.

:::

[comment]: # ({/53521d11-53521d11})

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

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

[comment]: # ({35e02b6a-6ba4bdd0})
#### 获取API版本

获取Zabbix API的version功能

请求:

```json
{
    "jsonrpc": "2.0",
    "method": "apiinfo.version",
    "params": [],
    "id": 1
}
```
响应:

```json
{
    "jsonrpc": "2.0",
    "result": "4.0.0",
    "id": 1
}
```

[comment]: # ({/35e02b6a-6ba4bdd0})

[comment]: # ({25499b5e-25499b5e})
### 来源

CAPIInfo::version() 位于 *ui/include/classes/api/services/CAPIInfo.php* 文件中。

[comment]: # ({/25499b5e-25499b5e})
