要读取(获取)所有 CI,请使用以下 URL 格式:
http://<hostname>:<port>/api/cmdb/ci/list/all/<Page Number>/
假设要读取与端口号为 8080 的本地服务器相关联的所有 CI,URL 应为:
http://localhost:8080/api/cmdb/ci/list/all
关键字
操作名称 “read”应作为 “POST attribute”发送,关键字为 “OPERATION_NAME”。
技术员密钥应作为 “POST attribute”发送,密钥为 “TECHNICIAN_KEY”。
注意: 如果未指定结果格式,API 将以 JSON 格式返回输出。
|
XML 输出示例
<API version="1.0"> <response> <result> <statuscode>200</statuscode> <status>Success</status> <message>Successfully fetched.</message> <created-date>May 7, 2013 11:18 AM</created-date> <field-names> <name type="String">CI Name</name> <name type="String">CI Type</name> <name type="String">Site</name> <name type="String">Description</name> </field-names> <field-values totalRecords="8"> <record> <value>Microsoft(R) Windows(R) Server 2003, Standard Edition (assetexplorer.helpdesk-test.com)</value> <value>Operating System</value> <value>(null)</value> <value>(null)</value> </record> <record> <value>balaguru.zohocorpin.com</value> <value>Windows Workstation</value> <value>(null)</value> <value>(null)</value> </record> <!-- Truncated --> <record> <value>1 (hp2650.csez.zohocorpin.com)</value> <value>Switch Ports</value> <value>(null)</value> <value>Created while scanning..</value> </record> <record> <value>2 (hp2650.csez.zohocorpin.com)</value> <value>Switch Ports</value> <value>(null)</value> <value>Created while scanning..</value> </record> </field-values> </result> </response> </API> Copy to clipboardCopy to clipboard
JSON 输出示例
{ "API" : { "response" : { "result" : { "created-date" : "Sep 2, 2013 12:08 PM",
"field-names" : { "name" : [ { "content" : "CI Name",
"type" : "String"
},
{ "content" : "CI Type",
"type" : "String"
},
{ "content" : "Site",
"type" : "String"
},
{ "content" : "Description",
"type" : "String"
}
] },
"field-values" : { "record" : [ { "value" : [ "administrator",
"Technician",
"(null)",
"3ED8AEC2-A7D1-42F6-9A90-8B848E70D077"
] },
{ "value" : [ "Administration",
"Department",
"Pleasanton,CA",
"(null)"
] },
{ "value" : [ "Engineering",
"Department",
"Pleasanton,CA",
"(null)"
] },
{ "value" : [ "Sales",
"Department",
"Pleasanton,CA",
"(null)"
] },
{ "value" : [ "Finance",
"Department",
"Pleasanton,CA",
"(null)"
] },
{ "value" : [ "IT Services",
"Department",
"Pleasanton,CA",
"(null)"
] },
{ "value" : [ "nprasanna-0157.csez.zohocorpin.com.",
"Windows Workstation",
"(null)",
"(null)"
] },
{ "value" : [ "Microsoft Windows 7 Professional (nprasanna-0157.csez.zohocorpin.com.)",
"Operating System",
"(null)",
"(null)"
] },
{ "value" : [ "dept1",
"Department",
"(null)",
"(null)"
] },
{ "value" : [ "dept2",
"Department",
"(null)",
"(null)"
] },
{ "value" : [ "dept3",
"Department",
"(null)",
"(null)"
] },
{ "value" : [ "Research and Development",
"Department",
"(null)",
"(null)"
] },
{ "value" : [ "Healthcare",
"Department",
"(null)",
"(null)"
] },
{ "value" : [ "HR",
"Department",
"(null)",
"(null)"
] },
{ "value" : [ "Service",
"Department",
"(null)",
"(null)"
] }
],
"totalRecords" : "15"
},
"message" : "Successfully fetched.",
"status" : "Success",
"statuscode" : "200"
} },
"version" : "1.0"
} }