获取两个配置项之间的关系

要读取配置项的特定关系,请使用以下网址:

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

假设您要阅读CI的特定关系-例如:技术员正在使用的服务器-端口8080在本地服务器中可用,则URL应指定为:

http://localhost:8080/api/cmdb/cirelationships/connector.iad8.amazon.com<->dlf-1w.printer-1/

关键点:

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

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

  3. 技术员密钥应与 TECHNICIAN_KEY密钥一起作为 POST属性发送

注意事项

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

  • 参数Result Format - Optional指定返回格式(XML或JSON),如果未指定返回格式,则API将以JSON格式返回输出。

必填参数

  • 两个配置项之间的符号<->是强制性的

  • CI名称1-强制性的。CI名称可以不区分大小写。


两个配置项关系的XML输出示例:


在这里,webserver connector.iad8.amazon.com与dlf-1w.printer-1打印机连接。

<?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:51 PM</created-date>
<relationships for="connector.iad8.amazon.com">
<relationship>
<name>Connected to</name>
<ci>
<type>Printer</type>
<name>dlf-1w.printer-1</name>
<relattributes/>
</ci>
</relationship>
</relationships>
</result>
</response>
</API>


JSON应答示例:


{
"API": {
"response": {
"result": {
"created-date": "Sep 2, 2013 03:05 PM",
"message": "Successfully fetched.",
"status": "Success",
"statuscode": "200",
"relationships": {
"relationship": {
"ci": {
"type": "Switch Ports",
"name": "connector.iad8.amazon.com"
},
"name": "Connected to"
},
"for": "DLF11thFloor-I.csez.zohocorpin.com"
}
}
},
"operation": {
"name": "read"
},
"version": "1.0"
}
}