要读取(获取)组织中可用的配置项的数量,请使用以下URL格式:
http://<hostname>:<port>/api/cmdb/ci/count/all/
假设您要读取与端口号为8080的本地服务器关联的CI的数量,则URL应指定为:
http://localhost:8080/api/cmdb/ci/count/all
关键点:
操作名"read"应通过密钥"OPERATION_NAME"作为"POST attribute"发送。
技术员密钥应通过密钥"TECHNICIAN_KEY"作为"POST attribute"发送。
注意事项: 如果未指定结果格式,则API将以JSON格式返回输出。
|
获取所有配置项计数的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>
获取所有配置项计数的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"
}
}