Skip to main content
Question

Add content in VMgroup using REST API

  • 20 July 2024
  • 2 replies
  • 28 views

I’m trying to add VM in existing VMgroup using REST API.
In the VMgroup there are already many VMs are existing.


Following the rule of sample from “Modify VM Group Details”  didn’t work.

‘’’
 curl -w -L -k -w "%{http_code}" -o response.txt -X PUT 'https://mycommvault/commandcenter/api/V4/VmGroup/12' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authtoken: $Token' \
--data-raw '{
  "content": {
    "overwrite": false,
    "virtualMachines":
      {
          "name": "vm",
          "GUID": "xxxx-xxx-xxx-xxxx",
          "type": "VM"
       }
    ],
  },
}'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   319    0     0  100   319      0   6645 --:--:-- --:--:-- --:--:--  6645
500

‘’’

it worked when “overwrite” is true. but  the rest of VMs were deleted from this VMgroup.

Am I missing something?
How can I add VM on top of existing VM and not change anything else?

 

2 replies

Userlevel 7
Badge +23

Try setting the value for subClientProperties.vmContentOperationType property in the json request to "ADD"

If not, I would open a support case as the doc clearly states:

content object

  • overwrite boolean

    Default value: false

    True if content in vmgroup has to be overwritten, by default it will append the content

Userlevel 5
Badge +16

I think there needs to be some sort of clarification.

 

The vm group can either be static or generated as a result of the discovery run against the subclient content of the vCenter psuedoclient.

 

so the question I have it how is your vm content currently defined, i.e static or via rules.

This isn’t answering your question just being exploratory, since you may be better served by modifying the subclient content rather than editing the group.

 

 

Reply