Using the get query for Device object to get some specific information for the device like: Hostname, Ipaddress, collectionTime, location, and deviceType, howerver requiring to get an extra information that is located in InventoryDetails Object: udiSerialNr, Could I mix informationfrom Device and InventoryDetails.
a) Get Device: Getting all the parameters from Device:
https://szier-m8-106.cisco.com/webacs/api/v1/data/Devices
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<queryResponse rootUrl="https://szier-m8-106.cisco.com/webacs/api/v1/data" requestUrl="https://szier-m8-106.cisco.com/webacs/api/v1/data/Devices/42" responseType="getEntity">
<entity url="https://szier-m8-106.cisco.com/webacs/api/v1/data/Devices/15" type="Devices" dtoType="devicesDTO">
<devicesDTO id="15" displayName="String value">
<clearedAlarms>1</clearedAlarms>
<collectionDetail>String value</collectionDetail>
<collectionTime>2014-12-04T10:16:28.284-08:00</collectionTime>
<creationTime>2014-12-04T10:16:28.284-08:00</creationTime>
<criticalAlarms>1</criticalAlarms>
<deviceId>15</deviceId>
<deviceName>String value</deviceName>
<deviceType>String value</deviceType>
<informationAlarms>1</informationAlarms>
<ipAddress>String value</ipAddress>
<location>String value</location>
<majorAlarms>1</majorAlarms>
<managementStatus>UNKNOWN</managementStatus>
<manufacturerPartNrs>
<manufacturerPartNr>String value</manufacturerPartNr>
</manufacturerPartNrs>
<minorAlarms>1</minorAlarms>
<productFamily>String value</productFamily>
<reachability>UNKNOWN</reachability>
<softwareType>String value</softwareType>
<softwareVersion>String value</softwareVersion>
<warningAlarms>1</warningAlarms>
</devicesDTO>
</entity>
</queryResponse>
b) Get InventoryDetails: I just showing the udiDetails for the device I am performing the query on Device in order to get the udiSerdialNr_:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<queryResponse rootUrl="https://szier-m8-106.cisco.com/webacs/api/v1/data" requestUrl="https://szier-m8-106.cisco.com/webacs/api/v1/data/InventoryDetails/42" responseType="getEntity">
<entity url="https://szier-m8-106.cisco.com/webacs/api/v1/data/InventoryDetails/15" type="InventoryDetails" dtoType="inventoryDetailsDTO">
<inventoryDetailsDTO id="15" displayName="String value">
<udiDetails>
<udiDetail>
<description>String value</description>
<modelNr>String value</modelNr>
<name>String value</name>
<productId>String value</productId>
<udiSerialNr>String value</udiSerialNr>
<versionId>String value</versionId>
</udiDetail>
</entity>
</queryResponse>
Could find both objects have same parameter: deviceId, how could you use it in order to include this information in the Device query.
There is no way to combine the two queries into one.
However, they are both enumerated with the same IDs; that is, api/v1/data/Devices/12345 is the same device as api/v1/data/InventoryDetails/12345. So you could query both API resources and correlate the data client-side.
- They are using the same ID, could use it to correlate the data, could you please let me know how could do it.
The correlation is something you'd have to do client-side; you'd have to program your client to do it or configure your off-the-shelf solution.
The specifics all depend on the client that's interacting with the API, and whatever you're using to persist the data. For example, if I were in your spot and using a document store to persist the data, I'd probably concurrently fetch from both API resources, merge each entity together, and then shove that merged document into the store.
Comments
0 comments
Please sign in to leave a comment.