Question

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

  • 8 December 2023
  • 4 replies
  • 55 views

Userlevel 5
Badge +16

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?


4 replies

Userlevel 1
Badge +3

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?

Userlevel 2
Badge +4

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

 

 

Userlevel 2
Badge +4

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

Userlevel 2
Badge +4

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

Reply