获取CI的特定关系

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

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

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

http://localhost:8080/api/cmdb/cirelationships/CI Name/Charles/Uses

关键点:

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

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

注意事项

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

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

必填参数

  • CI名称-必填。CI名称可以不区分大小写

  • 关系类型-强制性。关系类型名称可以不区分大小写。


读取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:57 PM</created-date>
<relationships for="Charles">
<relationship>
<name>Uses</name>
<ci>
<type>Server</type>
<name>opman-solaris1.csez.zohocorpin.com</name>
<relattributes/>
</ci>
<relationship>
</relationships>
</result>
</response>
</API>


读取CI特定关系的JSON输出示例:


{
"API": {
"response": {
"result": {
"created-date": "Sep 2, 2013 02:59 PM",
"message": "Successfully fetched.",
"status": "Success",
"statuscode": "200",
"relationships": {
"relationship": {
"ci": {
"type": "Mac Workstation",
"relattributes": {},
"name": "sdp-imac.csez.zohocorpin.com"
},
"name": "Uses"
},
"for": "Charles"
}
}
},
"operation": {
"name": "read"
},
"version": "1.0"
}
}