Cannot Get DeviceID Working in API Call

book

Article ID: 197246

calendar_today

Updated On:

Products

CA Infrastructure Management CA Performance Management - Usage and Administration DX NetOps

Issue/Introduction

We use the following API call to retrieve availability:

http://<DA_SYSTEM>:8581/odata/api/devices?$select=Name,PrimaryIPAddress,Location&$filter=((availabilitymfs/im_Availability lt 100))

How can we modify this call to get the real DeviceID (xxxx below) for to show the basic device page in CAPM for this URL:
https://<PC_SYSTEM>/pc/desktop/page?pg=sw&DeviceID=xxxx

Environment

Release : 19.3

Component : CA Performance Center

Resolution

1. We need to get the datasourceid for the data agregator from the mysql database on CAPC. 

mysql -unetqos -p<PASSWORD> netqosportal
mysql> select SourceID,ConsoleName from  data_sources2;

2. Then use the SourceID (in this example 3) in the URL below to do a POST using the DA ItemID (in this example 56330) which you can get through the API on the DA. Note you can have multiple LocalID's in the body. 

http://<PC_SYSTEM>:8181/pc/center/webservice/datasources/dataSourceId/3/itemids

Body:
<LocalIDs>
<LocalID ID="56330"/>
</LocalIDs>


3. This will retun:

<?xml version="1.0" encoding="UTF-8"?>
<ItemIDResults>
    <ItemIDResult LocalID="56330" ItemID="38241"/>
</ItemIDResults>

4. Take the ItemID from above and use this for the DeviceID

http://<PC_SYSTEM>/pc/desktop/page?pg=sw&DeviceID=38241


Just as a note out can also get the DA id from CAPC using this and the CAPC id for DSSOURCEID. 

POST <http://<PC_SYSTEM>:8181/pc/center/webservice/datasources/dataSourceId/<DSSOURCEID>/localids>
Body:
<ItemIDs>
<ItemID ID="id1"/>
<ItemID ID="id2"/>
</ItemIDs>