Skip to main content
Solved

Add a client to multiple groups using the rest api does nothing.


christopherlecky
Byte
Forum|alt.badge.img+17

I am attempting to add a client to multiple groups using the following rest api.

 

REST API - POST Client Properties (commvault.com)

 

 

The api returns 200 and some Json but does nothing.

 

what am I missing here?

Best answer by christopherlecky

You’re welcome.

View original
Did this answer your question?

9 replies

Forum|alt.badge.img+3
  • Vaulter
  • 17 replies
  • December 11, 2023

Hello @christopherlecky ,

Thank you for reaching us out, if this the complete script? And also. can you send Webserver.log and Webconsole.log from the Commserver right after performing the operation?


Forum|alt.badge.img+4
  • Vaulter
  • 11 replies
  • December 12, 2023

Hi @christopherlecky ,

I have 2 suggestions:

If you want to use the POST client properties API, can you try changing:

<clientGroupsOperationType>Update</clientGroupsOperationType>

to:

<clientGroupOperationType>Update</clientGroupOperationType>

 

See if that works, just considering that the XML that we provide may be incorrect, but my other concern is that the BOL link you shared does not mention this parameter and this link to the API call does not have an example for adding a client to a client group even though it is part of the  XML we supply:  https://api-next.commvault.com/docs/api/cv/ClientOperations/post-client-client-id so I am not sure it is intended to work.

 

[I will try test this out for you when I can and report back]

 

In the interim my second suggestion is one that works as I have written REST API calls based on in the past (I will look to try the above as well for you when I get a chance and reply)

You may like to consider using a different API call to add clients to a client group for example:

https://documentation.commvault.com/2022e/expert/rest_api_post_client_group_properties.html#json
https://api.commvault.com/#7c0665fa-0b03-4dc1-a2a5-bbb9fdde5455

As mentioned above I have already tested these methods in the past and know that they work (I was running 11.28.x at the time)

 

So this takes it from a different perspective, you are updating the client groups and adding the desired clients to the client group.

 

Let me know what you think, in the interim, when I can I will test out the post client properties REST API call and let you know what I can work out.

Regards,

 

Michael

 

 


Forum|alt.badge.img+4
  • Vaulter
  • 11 replies
  • December 12, 2023

Hi, Just reviewing the more recent documentation for REST API, perhaps the link I sent for my second suggestion is now deprecated?

Seems this may be the new way to associate clients to a client group: https://api-next.commvault.com/docs/api/cv/OpenAPI3/update-server-group-association

 

I have not used this new REST API method yet, but may also be a potential alternative.

I will check out the post client properties when I can though and let you know what I work out.

 

Regards,

 

Michael


Forum|alt.badge.img+4
  • Vaulter
  • 11 replies
  • December 12, 2023

Hi @christopherlecky ,

You may like to share your code that you are using, I worked in a 11.32.23 environment and I was able to use this code to successfully add a client to a client group:

 

 

And the client is added to my client group named “MyGroup01”

I am using the Powershell modules to run the REST API calls.

I could not get the post client properties to work, but I do not get a success error message either, I get:

 

I am sure if I have more time I can work this out further and provide further insight but it may be quicker if you share screen shots of your code, here is the json body I was using as a sample:

 

Where 1293 is the client ID for the client I want to update the properties on that has client name “myClientName”

I get an internal Server error 500 trying to update the client groups for this client group this way so am curious to know the syntax you are using where it returns a success error code of 200.

Regards,

Michael


Forum|alt.badge.img
  • Bit
  • 2 replies
  • April 4, 2024

Sorry to re-open this but I have the same issue as @christopherlecky in that trying to update the client properties returns a success but actually does nothing.

I’ve tried both methods @Michael mentioned and neither work as expected.

This sample code does nothing but is successful

And this method removes all existing clients from an existing group and replaces them with this single client. This is a bit of a disaster for me as the group is used for network FW rules.

Not sure what I’m doing wrong but I’m trying to add a new client to the existing FW Client Group and then push the network config to the new client with this

Not sure if anyone can see any obvious mistakes or if during the past 3 months you have this working. Any help would be greatly appreciated as this for me is the last piece in automating CV client installs for our non prod environments.

Thanks

John


christopherlecky
Byte
Forum|alt.badge.img+17

I could only get it to work using “OVERWRITE” 

 

If you attempt to use update it will fail if the client is a member of any automatic group.


christopherlecky
Byte
Forum|alt.badge.img+17

Youll have to enumerate the client group membership first then add it to the list off groups you are adding. Two operations rather than one


Forum|alt.badge.img
  • Bit
  • 2 replies
  • April 5, 2024

@christopherlecky Thanks for the pointer. You indeed have to enumerate the group and get the existing clients, build a new client list with the new client included and then send this list back to the client group. This works

would be a lot easier if REST API - POST Client Properties (commvault.com) worked.

Thanks again


christopherlecky
Byte
Forum|alt.badge.img+17

You’re welcome.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings