获取所有配置项(CI)明细

要获取所有CI明细,请使用以下URL:

http://<hostname>:<port>/api/cmdb/ci/list/all/<Page Number>/

假定您要获取与本地服务器的端口号为8080关联的所有配置项,则URL应为:

http://localhost:8080/api/cmdb/ci/list/all

关键点:

  1. 输入是以密钥"INPUT_DATA"作为"POST attribute"发送的XML字符串。

  2. 操作名"read"应通过密钥"OPERATION_NAME"作为"POST attribute"发送。

  3. 技术员密钥应通过密钥"TECHNICIAN_KEY"作为"POST attribute"发送。

注意事项

如果未指定结果格式,则API将以JSON格式返回输出

  • 获取没有配置项类型详细信息的所有配置项,请使用all。

  • 参数相关:获取特定CI类型的CI,在URL中输入CI类型值。

  • 参数相关:Page Number - Optional指定页面或结果以检索。

  • 参数相关:Result Format - Optional指定返回格式(XML或JSON),如果未指定返回格式,则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>


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"
} }