Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology

REST API examples related to devices, devicegroups and trust domain

Looking for links that shows REST API usage for the below with example POST bodies and correct usage

  1. Check for a device group (https://{{ server_ip }}:{{ device_port }}/mgmt/tm/cm/device-group/ ?)
  2. Check for devices in a device group ( https://{{ server_ip }}:{{ device_port }}/mgmt/tm/cm/device-group/{{DeviceGroupName}}/devices ?)
  3. Delete a device group ( https://{{server_ip }}:{{ device_port }}/mgmt/tm/cm/device-group/{{DeviceGroupName}} ?)
  4. Remove from trust domain (https://{{server_ip }}:{{ device_port }}/mgmt/tm/cm/remove-from-trust/{{ instance_name }}?)

Appreciate any guidance with the above, Thanks in advance

Rate this Question
Comments on this Question
Comment made 2 months ago by Vish 1

I got the below response from @tar on F5CloudSolutions slack channel

tar [4:25 PM]@Vish

1 https://github.com/F5Networks/f5-ansible/blob/devel/library/modules/bigip_device_group.py#L464

library/modules/bigip_device_group.py:464 def exists(self): F5Networks/f5-ansibleAdded by GitHub

2 https://github.com/F5Networks/f5-ansible/blob/devel/library/modules/bigip_device_group_member.py#L213

library/modules/bigip_device_group_member.py:213 def exists(self): F5Networks/f5-ansibleAdded by GitHub

3 https://github.com/F5Networks/f5-ansible/blob/devel/library/modules/bigip_device_group.py#L544

library/modules/bigip_device_group.py:544 def remove_from_device(self): F5Networks/f5-ansibleAdded by GitHub

4 https://github.com/F5Networks/f5-ansible/blob/devel/library/modules/bigip_device_trust.py#L313

library/modules/bigip_device_trust.py:313 def remove_from_device(self): F5Networks/f5-ansibleAdded by GitHub


Answers to this Question


For those who wants to see straight curl command examples:

tmsh list cm device-group HA equivalent is (where HA is the device-group name):

curl -sku <user>:<pass> https://<host>/mgmt/tm/cm/device-group/HA?expandSubcollections=true

tmsh show cm device-group HA is:

curl -sku <user>:<pass> https://<host>/mgmt/tm/cm/device-group/HA/stats

tmsh list cm device-group HA devices is:

curl -sku <user>:<pass> https://<host>/mgmt/tm/cm/device-group/HA?\$select=devicesReference

To remove the device-group HA, you need to first remove the devices from the group:

tmsh modify cm device-group HA devices none is:

curl -sku <user>:<pass> https://<host>/mgmt/tm/cm/device-group/HA \
  -X PATCH -H "Content-type: application/json" \
  -d '{"devicesReference": {"items": []}}'

tmsh delete cm device-group HA is:

curl -sku <user>:<pass> https://<host>/mgmt/tm/cm/device-group/HA -X DELETE

tmsh delete cm trust-domain all is

curl -sku <user>:<pass> https://<host>/mgmt/tm/cm/trust-domain -X DELETE