vSphere Client JavaScript API: Application Interface

The app interface provides context object information and helps your plug-in navigate and control the vSphere Client user interface.

app.getApiEndpoints() method

Signatureapp.getApiEndpoints():UiApiEndpoint
DescriptionReturns the URLs of the vsphere-ui service API endpoints available to plug-ins.

app.getContextObjects() method

Signatureapp.getContextObjects():any[]
DescriptionReturns the current context objects.
Return value:
for global view
Returns empty array. Global views have no context.
for vSphere object
Returns a context item for the associated vSphere object.
for dialog opened by modal.open()
If dialog opened by htmlClientSdk.modal.open(configObj), returns value of configObj.contextObjects (or empty array, if contextObjects undefined)
for dialog opened by plugin.json actions
If dialog opened by action defined in plugin.json, returns an array of context items.

A context item is a JavaScript object containing a single property, id:string. This is the ID of the associated vSphere object.

app.navigateTo() method

Signatureapp.navigateTo(options:NavigationOptions):void
DescriptionNavigates to a specified view, and optionally passes custom data to the view.
Parameter: optionsSpecifies the destination view and custom data.

app.getNavigationData() method

Signatureapp.getNavigationData():any
DescriptionReturns the custom data passed to the view by the navigateTo() method. (If no custom data passed, returns null.)

app.getClientInfo() method

Signatureapp.getClientInfo():ClientInfo
DescriptionReturns type and version info for the vSphere Client.

app.getClientLocale() method

Signatureapp.getClientLocale():string
DescriptionReturns the current locale of the vSphere Client.

app.getSessionInfo() method

Signatureapp.getSessionInfo(callback):void
DescriptionRetrieves information about the client's authentication session.
The callback function must have the following signature:
function callback(sessionInfo:SessionInfo)

app.getTheme() method

Signatureapp.getTheme():PluginTheme
DescriptionRetrieves information about the theme the plug-in should use.

app.ClientInfo type

DescriptionDocuments type and version of vSphere Client.
NameTypeRequired?Notes
typestring info onlyThe vSphere Client type (HTML or Flex)
versionstringinfo onlyThe vSphere Client version string.

app.NavigationOptions type

DescriptionSpecifies a destination view and custom data for the view.
NameTypeRequired?Notes
targetViewIdstringyesNavigation ID of the destination view. (For a remote plug-in, this property must identify a view created by the same plug-in.)
objectIdstringnoID of any object associated with the view. (For a global view, this field is not required.)
customDataanynoA custom data structure passed to the view.

app.PluginTheme type

DescriptionIndicates the UI theme that is currently selected.
NameTypeRequired?Notes
namestring info onlyPossible values: light or dark.

app.QueryParam type

DescriptionHolds a single query parameter of a URL.
NameTypeRequired?Notes
namestring info onlyName of query parameter, as in ?name=value.
valuestringinfo onlyValue of query parameter, as in ?name=value.

app.SessionInfo type

DescriptionHolds information about the current session of the vSphere Client.
NameTypeRequired?Notes
sessionTokenstring info onlyIdentifier of the plug-in authentication session with vCenter Server.

app.UiApiEndpoint type

DescriptionHolds the parsed elements of the plug-in URL.
NameTypeRequired?Notes
originstring info only<protocol>://<hostname><port>
pathnamestringinfo only
queryParamsArray<QueryParam>info only<name>=<value>
fullUrlstringinfo only<origin>/<pathname>?<queryParams>