How do I delete a device from a group using uimapi
search cancel

How do I delete a device from a group using uimapi

book

Article ID: 374803

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

I would like to use uimapi to delete devices from device groups, how do I do that?

Environment

20.4.8+ and 23.4.*

Resolution

  1. Log into OC as administrator
  2. Change url without logging out to this
    http://<url for OC>/uimapi/swagger-ui/index.html
  3. Open the devicegroup section
  4. Select GET ​/uimapi​/devicegroups 
  5. Select Try it out
  6. Scroll down to Excecute
  7. Scroll down to the 200 section
    <devicegroups>
      <devicegroup>
        <id>2</id>
        <origin/>
        <active>1</active>
        <name>UNIX</name>
        <description/>
        <query/>
        <condition/>
        <cmGroupId>11</cmGroupId>
        <parentGroupId/>
        <accountid/>
        <status>ok</status>
        <group_type>2</group_type>
        <parentChanged>0</parentChanged>
        <variables>
          <group.name>UNIX</group.name>
          <group.id>11</group.id>
          <grp_id>11</grp_id>
        </variables>
      </devicegroup>
      <devicegroup>
        <id>3</id>
        <origin/>
        <active>1</active>
        <name>Windows</name>
        <description/>
        <query/>
        <condition/>
        <cmGroupId>3</cmGroupId>
        <parentGroupId/>
        <accountid/>
        <status>ok</status>
        <group_type>2</group_type>
        <parentChanged>0</parentChanged>
        <variables>
          <group.name>Windows</group.name>
          <group.id>3</group.id>
          <grp_id>3</grp_id>
        </variables>
      </devicegroup>
      <devicegroup>
        <id>64</id>
        <origin/>
        <active>1</active>
        <name>MyGroup</name>
        <description/>
        <query/>
        <condition/>
        <cmGroupId>32</cmGroupId>
        <parentGroupId/>
        <accountid/>
        <status>ok</status>
        <group_type>1</group_type>
        <parentChanged>0</parentChanged>
        <variables>
          <group.name>MyGroup</group.name>
          <group.id>32</group.id>
          <grp_id>32</grp_id>
        </variables>
      </devicegroup>
      <devicegroup>
        <id>65</id>
        <origin/>
        <active>1</active>
        <name>test</name>
        <description/>
        <query/>
        <condition/>
        <cmGroupId>215</cmGroupId>
        <parentGroupId/>
        <accountid/>
        <status>ok</status>
        <group_type>0</group_type>
        <parentChanged>0</parentChanged>
        <variables>
          <group.name>test</group.name>
          <group.id>215</group.id>
          <grp_id>215</grp_id>
        </variables>
      </devicegroup>
    </devicegroups>
  8. Find the <id>x</id> you are looking for and record it
  9. Repeat for getting the device_id from the group
    GET ​/uimapi​/devicegroups​/{mcs_grp_id}​/members
    populate the mcs_grp_id with the id from above
  10. Try it out
  11. Execute
  12. Record the device_id
    <devices>
      <device>
        <robot>true</robot>
        <cs_id>2842</cs_id>
        <device_id>2</device_id>
        <csdev_id>D1EBFB7D2448E0E6BC18581504AC276CC</csdev_id>
        <name>robot1</name>
        <status>UNAVAILABLE</status>
        <origin>uim_hub</origin>
        <os_type>UNIX</os_type>
        <nimbus_type>1</nimbus_type>
        <ip>xxx.xxx.xxx.xxx</ip>
        <cs_type>A</cs_type>
      </device>
      <device>
        <robot>true</robot>
        <cs_id>2847</cs_id>
        <device_id>7</device_id>
        <csdev_id>D255AA574C2D333038556D61507D86BFB</csdev_id>
        <name>robot2</name>
        <status>OK</status>
        <origin>uim_hub2</origin>
        <os_type>Windows</os_type>
        <nimbus_type>2</nimbus_type>
        <ip>xxx.xxx.xxx.xxx</ip>
        <cs_type>D</cs_type>
      </device>
    </devices>
  13. Select delete /uimapi/devicegroups/{mcs_grp_id}/members/{identifier}
  14. Try me out
  15. Put in the group_id and the device id
  16. Execute

    Here is an example of the interface

Additional Information

You can learn more here uim-api reference