Example: Get all Network Adapters
Use the CAM REST API to get an array of all network adapters on all computers.
https://{your-server}/cam/api/v1/hardware/computers/networkadapters
Filter the List of Network Adapters
Use filters to limit the list of items returned.
-
For example, use the following request to return a list of network adapters for a subnetMask of 225.225.0.0:
https://{your-server}/cam/api/v1/hardware/computers/networkadapters?filter=subnetMask eq "255.255.0.0"
-
Use the following request to get a list of network adapters with a DHCP lease expiration date after Aug. 1, 2019:
https://{your-server}/cam/api/v1/hardware/computers/networkadapters?filter=dhcpLeaseExpires gt "2019-08-01"
-
Use the following request to get a list of network adapters that are not connected to a network:
https://{your-server}/cam/api/v1/hardware/computers/networkadapters?filter=mediaDisconnected
-
Use the following request to get a list of network adapters that are connected to a network:
https://{your-server}/cam/api/v1/hardware/computers/networkadapters?filter=not mediaDisconnected
Shape the List of Network Adapters
Add fields to your request to limit the data returned for each item in the list.
For example, use the following request to limit the data returned to the fields specified:
https://{your-server}/cam/api/v1/hardware/computers/networkadapters?fields=name, description, ipAddress, adapterType, dhcpEnabled, mediaDisconnected
Sort the List of Network Adapters
Add field names and order to sort the list of network adapters returned.
For example, use the following request to return a list of network adapters sorted by name in descending order:
https://{your-server}/cam/api/v1/hardware/computers/networkadapters?sort=name desc
Combine Parameters
You can combine parameters to shape, sort, and filter the returned data.
For example, use the following request to return a list of network adapters that includes only the name, description, and IP address, that are not connected to a network, and that are sorted in descending order by name:
https://{your-server}/cam/api/v1/hardware/computers/networkadapters?filter=mediaDisconnected&fields=name, description, ipAddress&sort=name desc