DX NetOps

 View Only
  • 1.  LIST IDs OF ALL DEVICES

    Posted May 19, 2022 03:53 PM
    Hi

    how could list the IDs of all devices?

    the ID in the Inventory - Items - Devices window is not matching the Device admin role ID.

    The goal is a possible device name change, in a more global, massive way.

    Cássio


  • 2.  RE: LIST IDs OF ALL DEVICES

    Posted May 20, 2022 03:54 AM
    There are 2 API calls that make transformation of a PCItemID into a DAItemId:

    ---
    #With the data source ID (check data_sources2 table in PC) for DA, you can run (replace SOURCEID):
    #To convert DS ID to PC ID:
    #Body:
    <LocalIDs>
    <LocalID ID="id1"/>
    <LocalID ID="id2"/>
    </LocalIDs>
    #To convert PC ID to DS ID:
    #Body:
    <ItemIDs>
    <ItemID ID="id1"/>
    <ItemID ID="id2"/>
    </ItemIDs>
    ---
    Try it out.
    You can get the full DA list either by OpenAPI or by DA call. 

    #Build OData Query for Devices
    odata_query="odata/api/devices\$top=20000&\$skip=0&\$format=xml&\$select=SupportedProtocols,ID,PrimaryIPAddress,IPDomainID,DiscProfileID,Name,AlternateName,PolledItemCount,CreateTime,LifeCycleState&\$filter=((IPDomainID%20eq%20$daipdomainid))";

    curl
    -k -s -H "Content-Type: application/xml" -H "Authorization: Basic $hash_auth" -X GET "$daprotocol://$dahost:$daport/$odata_query"

    #Build OData Query for Interfaces
    odata_query2="odata/api/interfaces\$top=20000&\$skip=0&\$format=xml&\$select=ID,MACAddress,SpeedIn,AdminStatus,SpeedOut,Type,Alias,IPAddresses,DeviceItemID,IsPollEnabled,DisplayName,DisplayDescription,AlternateName,Name,Description,CreateTime&\$filter((device/IPDomainID%20eq%20$daipdomainid))";

    curl
    -k -s -H "Content-Type: application/xml" -H "Authorization: Basic $hash_auth" -X GET "$daprotocol://$dahost:$daport/$odata_query2"