要读取(获取)贵组织可用的 CI 数量,请使用以下 URL 格式:
http://<hostname>:<port>/api/cmdb/ci/count/all/
假设您要读取与端口号为 8080 的本地服务器相关联的 CI 数量,URL 应为
http://localhost:8080/api/cmdb/ci/count/all
关键字
操作名称 “read”应作为 “POST attribute”发送,关键字为 “OPERATION_NAME”。
技术员密钥应以 “POST attribute”的形式发送,其关键字为 “TECHNICIAN_KEY”。
注意: 如果未指定结果格式,API 将以 JSON 格式返回输出。
|
获取所有 CI计数的 XML 输出示例:
<?xml version="1.0" encoding="UTF-8"?>
<API version="1.0"><response>
<result>
<statuscode>200</statuscode>
<status>Sucess</status>
<message>Successfully fetched.</message>
<created-date>Mar 13, 2013 05:10 PM</created-date>
<field-names>
<name type="Integer">Count</name>
; </field-names>
<field-values totalRecords="1">
<record>
<value>30</value>
</record>
</field-values>
</result>
</response>
获取所有 CI计数的 JSON 输出示例:
{
"API": {
"response": {
"result": {
"created-date": "Sep 2, 2013 12:11 PM",
"field-names": {
"name": {
"content": "Count",
"type": "Integer"
}
},
"field-values": {
"record": {
"value": "1"
},
"totalRecords": "1"
},
"message": "Successfully fetched.",
"status": "Success",
"statuscode": "200"
}
},
"version": "1.0"
}
}