获取 CI 关系详细信息

获取 CI 关系详细信息

要读取 CI 之间的关系,请使用以下 URL 格式:

http://<servername>:<portnumber>/api/cmdb/cirelationships/CI Name/

假设您要获取本地服务器上端口号为 8080 的两个 CI 之间的关系,URL 应为:

http://localhost:8080/api/cmdb/cirelatiionships/CI Name/

 


关键字

  1. 操作名称 “read”应作为 “POST attribute”发送,其关键字为 “OPERATION_NAME”。

  2. 技术员密钥应作为 “POST attribute”发送,密钥为 “TECHNICIAN_KE”。

 

注意:  

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

  • 参数结果格式 - 可选。指定返回格式(XML 或 JSON)

 

读取 CI 关系的 XML 输出示例

 

<?xml version="1.0" encoding="UTF-8"?>

<API version="1.0">

    <response>

            <result>

                <statuscode>200</statuscode>

                <status>Success</status>

                <message>Successfully fetched.</message>

                <created-date>Mar 22, 2013 12:10 PM</created-date>

                       <relationships for="sdpvm-w2k8.zohocorpin.com.">

                           <relationship>

                            <name>Managed by</name>

                              <ci>

                                  <type>Technician</type>

                                   <name>Charles</name>

                                   <relattributes/>

                               </ci>

                           </relationship>

                           <relationship>

                           <name>Runs</name>

                              <ci>

                                  <type>Operating System</type>

                                  <name>Microsoft® Windows Server® 2008 Standard (sdpvm-w2k8.zohocorpin.com.)</name>

                              </ci>

                        </relationship>

                        <relationship>

                        <name>Uses</name>

                          <ci>

                                <type>Storage Device</type>

                                 <name>san-1</name>

                           </ci>

                         </relationship>

                         <relationship>

                        <name>Hosts</name>

                           <ci>

                               <type>IT Service</type>

                                <name>E-mail</name>

                                <relattributes/>

                          </ci>

                           </relationship>

                       </relationships>

            </result>        

    </response>

</API>


 

 

 

 

读取 CI 关系的 JSON 输出示例

 

 

 

Note: Please note that the Input and Output XML formats have been changed.

 

{

    "API": {

        "response": {

            "result": {

                "created-date": "Sep 2, 2013 01:09 PM",

                "message": "Successfully fetched.",

                "status": "Success",

                "statuscode": "200",

                "relationships": {

                    "relationship": {

                        "ci": {

                            "type": "Operating System",

                            "relattributes": {

                                "attribute": [

                                    {

                                        "value": "-",

                                        "name": "Installed On"

                                    },

                                    {

                                        "value": "-",

                                        "name": "Version"

                                    },

                                    {

                                        "value": "-",

                                        "name": "Installation Location"

                                    }

                                ]

                            },

                            "name": "Microsoft® Windows Server® 2008 Standard (sdpvm-w2k8.zohocorpin.com.)"

                        },

                        "name": "Runs"

                    },

                    "for": "sdpvm-w2k8.zohocorpin.com."

                }

            }

        },

        "operation": {

            "name": "read"

        },

        "version": "1.0"

    }

}