Get network devices - Metasys - LIT-12013522 - Software Application - Basic Services client library for .NET (and COM) - Metasys API - 4.2

Metasys REST Client for .NET and COM Developer Guide

Brand
Metasys
Product name
Basic Services client library for .NET (and COM)
Metasys API
Document type
API Reference Guide
Document number
LIT-12013522
Version
4.2
Revision date
2021-04-07
Language
English (United States)

To get all the devices on the network, use the GetNetworkDevices method. The library delivers a collection of Metasys object items. If you want to filter the response, the method accepts a parameter.

To get the device types on the network, use the GetNetworkDeviceTypes method. The library delivers a collection of MetasysObjectType items.

Table 1. Get network devices .NET signature
Library method name GetNetworkDevices
Description Get all devices on the network.
Method signature IEnumerable<MetasysObject> GetNetworkDevices(string type = null);
Method input parameters Optional

type: type of network devices used as a filter.

Return value A collection of MetasysObjects that represent the devices.

The following .NET C# code is an example of a successful Metasys object response.

List<MetasysObjectType> types = client.GetNetworkDeviceTypes().ToList();
Console.WriteLine(types[0]);
/*                       
  {
    "Description": "NAE55-NIE59",
    "DescriptionEnumerationKey": "objectTypeEnumSet.n50Class",
    "Id": 185
  }
*/
int type1 = types[0].Id;
List<MetasysObject> devices = client.GetNetworkDevices(type1.ToString()).ToList();
MetasysObject device = devices.LastOrDefault();
Console.WriteLine(device);
/*                      
  {
    "ItemReference": "Win2016-VM2:vNAE2343996",
    "Id": "142558f8-c4c7-5f89-be97-d806adb72053",
    "Name": "vNAE2343996",
    "Description": "",
    "Type": null,
    "TypeUrl": "https://win2016-vm2/api/v2/enumSets/508/members/185",
    "Category": null,
    "Children": [],
    "ChildrenCount": 0
  }
*/