Reply to Message

View discussion in a popup

Replying to:
kumargandhi16
Contributor
Contributor

Hi @Denis_Chorbadzh 

I checked the Java code for getUserSession()...In general what it does is read the values defined in the Configuration class, like, there are few constants defined in the class, and Java backend just sets and gets these values?, looks like they are hardcoded or reading from env fields? (Not entirely sure, I am not a Java dev)

But, the getUserSession() API from the Html bridge JavaScript actually gives the serversInfo and linkedServersInfo dynamically. PFB screenshot.

WEB_PLATFORM_getUserSession.png

It's sad that htmlClientSdk (JavaScript APIs) doesn't have such API!!.

We have a linked vCenters setup and we are having trouble fetching the right api-endpoint that we need to set in the headers for our API calls.

PFB screenshot of out current setup. We have two plugin instances, each with its own vCenter.

Linked_vCenters_New.png

Now the problem is getting the right api-endpoint for the selected plugin instance.

PFB code for the three headers we set in the remote-vcp UI code.

 

// Below are the headers we set for UI API calls.
getHttpClientHeaders(): any {
      return {
         "vcenter-guid": this.getGUID(),
         "vmware-api-ui-endpoint-url": this.getUIApiEndpointUrl(),
         "vmware-api-session-id": this.getVMwareAPISessionId()
      };
   }

// Below fetching the API end point, but what about for linked setup!!
getUIApiEndpointUrl() {
   return this.gs.getClientSdk().app.getApiEndpoints().uiApiEndpoint.fullUrl;
}

 

Can you please provide some feedback? Thanks.

Reply
0 Kudos