Solved

Getting the api equivalent to a gui action.

  • 19 April 2024
  • 5 replies
  • 53 views

Userlevel 2
Badge +10

How do I get the api equivalent to this:

 

 

icon

Best answer by clecky 19 April 2024, 17:54

View original

5 replies

Userlevel 5
Badge +11

@clecky ,

That should be this REST API call.

https://documentation.commvault.com/v11/essential/rest_api_post_virtualization_client.html

Regards,

Edward J Holowienka

Userlevel 2
Badge +3

Hello @clecky 

 

For this one, I am not sure if API’s get logged for Commcell Console Activity. I did test in my lab by bumping up debug level on EvMgrS service to 10, tried adding a client but could only find XML information in the logging. 

 

However, you can certainly find this in Command Center with higher debug. If you bump up the debug level for WebServer.log to 10, it should list the API’s being used for any activity. 

 

For example:

 

  • Debug Level set to 10 on my Command Center server:
  • Under Protect → File Servers → Added a dummy “Test2” client
  • Logs show the following in WebServer.log:

7728  177   04/19 10:24:10 177 ###  - WEBAPI-STARTED processing [POST]:[/InstallClient] request. : /InstallClient : Headers :[Accept=application/json][Accept-Encoding=gzip, deflate, br, zstd][Accept-Language=en-US,en;q=0.9][Content-Length=538][Content-Type=application/json][Host=cgwma.cglab.local:81][Referer=https://cgwma.cglab.local/commandcenter/embeddedCc/index.jsp][locale=en-US,en;q=0.9][client-location=192.168.1.10][LookupNames=false][SendPatchingInfo=true][sec-fetch-mode=cors][sec-fetch-site=same-origin][cc-http-ref=https://cgwma.cglab.local/commandcenter/embeddedCc/index.jsp#/fsServers/addFileServer][origin=https://cgwma.cglab.local][ref-endpoint=proxy//InstallClient][csrf=5eff807eb0b54bc9ba31b03599b33356][timezoneinfo=-04:00][x-original-host=cgwma.cglab.local][ref-page=#/fsServers/addFileServer][sec-ch-ua="Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"][sec-ch-ua-mobile=?0][sec-ch-ua-platform="Windows"][x-requested-with=XMLHttpRequest][ts=1713536071586][ref-ts=1713536740656][sec-fetch-dest=empty][FormatOutput=false][SkipOldJsonConverter=true][trace-id=ws0d4f4fca6390][WEBSERVERCORE-FLAG=true] : AdditionalInfo[ ConsoleType[AdminConsole]ClientIP[192.168.1.10] Operation[CV.WebServer.Controllers.ClientController.InstallClient (CVWebControllerClient)] isTokenSupplied?[True] Username[admin]] : Request : <TMMsg_ClientInstallRequest rebootClient="0"><packages packageId="702" packageName="File System" /><entities hostName="test2" displayName="test" clientId="0" clientName="test" /><createPseudoClientRequest registerClient="1"><clientInfo clientType="0"><subclientInfo useLocalContent="1" contentOperationType="1"><fsSubClientProp useGlobalFilters="2" backupSystemState="1" /><content path="\" /></subclientInfo><plan planName="Servers" planId="2" /></clientInfo></createPseudoClientRequest><clientAuthForJob userName="test/test" /></TMMsg_ClientInstallRequest>

 

You can see the header information and inside the “TMMsg_ClientInstallRequest”, you can see the body of the REST API used. 

 

We also have the “Equivalent API” button, which will generate API requests for actions done int he Command Center as well:

 

 

Please let me know if this helps!

 

-- Chuck Graves

Userlevel 2
Badge +10

Hello @clecky 

 

For this one, I am not sure if API’s get logged for Commcell Console Activity. I did test in my lab by bumping up debug level on EvMgrS service to 10, tried adding a client but could only find XML information in the logging. 

 

However, you can certainly find this in Command Center with higher debug. If you bump up the debug level for WebServer.log to 10, it should list the API’s being used for any activity. 

 

For example:

 

  • Debug Level set to 10 on my Command Center server:
  • Under Protect → File Servers → Added a dummy “Test2” client
  • Logs show the following in WebServer.log:

7728  177   04/19 10:24:10 177 ###  - WEBAPI-STARTED processing [POST]:[/InstallClient] request. : /InstallClient : Headers :[Accept=application/json][Accept-Encoding=gzip, deflate, br, zstd][Accept-Language=en-US,en;q=0.9][Content-Length=538][Content-Type=application/json][Host=cgwma.cglab.local:81][Referer=https://cgwma.cglab.local/commandcenter/embeddedCc/index.jsp][locale=en-US,en;q=0.9][client-location=192.168.1.10][LookupNames=false][SendPatchingInfo=true][sec-fetch-mode=cors][sec-fetch-site=same-origin][cc-http-ref=https://cgwma.cglab.local/commandcenter/embeddedCc/index.jsp#/fsServers/addFileServer][origin=https://cgwma.cglab.local][ref-endpoint=proxy//InstallClient][csrf=5eff807eb0b54bc9ba31b03599b33356][timezoneinfo=-04:00][x-original-host=cgwma.cglab.local][ref-page=#/fsServers/addFileServer][sec-ch-ua="Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"][sec-ch-ua-mobile=?0][sec-ch-ua-platform="Windows"][x-requested-with=XMLHttpRequest][ts=1713536071586][ref-ts=1713536740656][sec-fetch-dest=empty][FormatOutput=false][SkipOldJsonConverter=true][trace-id=ws0d4f4fca6390][WEBSERVERCORE-FLAG=true] : AdditionalInfo[ ConsoleType[AdminConsole]ClientIP[192.168.1.10] Operation[CV.WebServer.Controllers.ClientController.InstallClient (CVWebControllerClient)] isTokenSupplied?[True] Username[admin]] : Request : <TMMsg_ClientInstallRequest rebootClient="0"><packages packageId="702" packageName="File System" /><entities hostName="test2" displayName="test" clientId="0" clientName="test" /><createPseudoClientRequest registerClient="1"><clientInfo clientType="0"><subclientInfo useLocalContent="1" contentOperationType="1"><fsSubClientProp useGlobalFilters="2" backupSystemState="1" /><content path="\" /></subclientInfo><plan planName="Servers" planId="2" /></clientInfo></createPseudoClientRequest><clientAuthForJob userName="test/test" /></TMMsg_ClientInstallRequest>

 

You can see the header information and inside the “TMMsg_ClientInstallRequest”, you can see the body of the REST API used. 

 

We also have the “Equivalent API” button, which will generate API requests for actions done int he Command Center as well:

 

 

Please let me know if this helps!

 

-- Chuck Graves

 

 

Gui action can be logged, but it has to be enabled.

See here.

 

The reason I asked is because I was trying to capture what is being submitted but could not find it in any of the logs on the webserver.

 

The equivalent api doesn’t help because while it does give a preview it doesn’t create the vm client. 

This is what is created from the GUI

<EVGui_PreviewInventoryReq createClientsForDiscoveredVms="1">

<appId applicationName="Virtual Server" apptypeId="" backupsetId="" backupsetName="vsphere.local" clientId="" clientName="" instanceId="" instanceName="" subclientId=“" subclientName=“"/>

</EVGui_PreviewInventoryReq>

For the record I did try to bump up the logging on webserver, but I just wasn’t seeing this request come through.

Thanks for all the help. 

I was trying to tackle this from multiple angles in case one didn’t pan out.


edit: removed identifying information 

 

Userlevel 2
Badge +10
createClientsForDiscoveredVms="1"

Seems to be what is missing in the other sub-client preview apis.

They are both using

EVGui_VirtualGuestHostList 

Now I have to track down the response both for when a vm client is created and when nothing is created.

 

Userlevel 2
Badge +10

The submission takes the form of:

<EVGui_PreviewInventoryReq createClientsForDiscoveredVms="1">

<appId applicationName = "Virtual Server"
apptypeId = "1036"
backupsetId = "1173343"
backupsetName = "made up backupset name"
clientId = "17320"
clientName = "myventer.community.commvault.com"
instanceId = "36934"
instanceName = "VMware"
subclientId = "13349"
subclientName = "Made up subclient name"/>

</EVGui_PreviewInventoryReq>

 

A bunch of this seems redundant. I assume the only thing you need is the subclient ID.

Reply