Hi Abby,
For objectId you need to use the JS API call WEB_PLATFORM.getObjectId(). See vm-data.js from the WSSDK sample.
For the session info you need to use the Java API:
- Get the user session from the UserSessionService.
- Use the "serversInfo" array which contains ServerInfo objects for each of the vCenters in the environment. This object in turn contains the necessary info - sessionKey, sessionCookie, serviceGuid. This also means that you don't need to make a separate vCenter call (via vim25 or vi-java) to fetch the serverGuid.
See DataProviderImpl.getServiceContent again from WSSDK sample to have a look at how this is showcased.
Note: If your plugin is supposed to work only on 6.5 and 6.7 please consider using the new JS APIs () as the Bridge JS APIs have been deprecated and will be removed at some future point when the community is ready for that. If you need to support also 6.0 or earlier you should indeed use the Bridge JS APIs.
Cheers,
Vladi
Thanks Valdi, we got both sessionCookie and ObjectId. Appreciate your help.
Now we just need the VCSA IP and port to call our rest API of backend remote server.
Any JS API/SDK API which can get us the VCSA IP and port number?
Hi Abby,
The vCenter API URLs are also available from the UserSession Java API. You can get them from UserSessionService.getUserSession().serversInfo[].serviceUrl. From the URLs you can extract the host and the port.
Best,
Tony