Skip to main content

MstrEnvironment class

Available since 2021 Update 9 (May 2023)

The instance of this class is the object returned from the microstrategy.embeddingComponent.environments.create() function, which allows access to the MicroStrategy application. MstrEnvironment class represents one MicroStrategy Library Application identified by a URL.

APIs

The load dossier API

Function

async loadDossier(props)

Input Parameters

Parameter NameData TypeDescriptionIs Required
props.projectIdStringThe project ID, which must be a GUID.true
props.objectIdStringThe dossier ID, which must be valid. If the ID is a document or report ID, an error is reported.true
props.instanceIdStringThe dossier instance ID, if it already exists.false

The projectId + objectId is used as the dossier identifier. If the function is called twice with the same parameter, the same MstrDossier object is returned in the callback.

Response

This API returns a promise object that resolves to a MstrDossier object.

Example

try {
const environment = await microstrategy.embeddingComponent.environments.create({
serverUrl: "https://demo.microstrategy.com/MicroStrategyLibrary",
getAuthToken: () => {
// Logic similar to the existing Native Embedding SDK, but only standard auth login is allowed
},
});
// Begin here
const dossier = await environment.loadDossier({
projectId: "B19DEDCC11D4E0EFC000EB9495D0F44F",
objectId: "D9AB379D11EC92C1D9DC0080EFD415BB",
});
} catch (error) {
// Your own error handling logic
}

API Errors

Error CaseError CategoryHandling ModuleError Handling
The input parameter fails input validationInvalid inputNative Embedding SDKCaught by the catch() of the promise object
Other REST API errorsOtherNative Embedding SDKCaught by the catch() of the promise object

The destroy dossier API

Function

async unloadDossier(dossier)

Input Parameters

Parameter NameData TypeDescriptionIs Required
dossierMstrDossier classThe MstrDossier object created by the loadDossier functiontrue

Response

This API returns a promise object that resolves to a MstrDossier object.

Example

try {
// The logic to generate a MstrDossier object
await environment.unloadDossier(dossier);
} catch (error) {
// Your own error handling logic
}

API Errors

Error CaseError CategoryHandling ModuleError Handling
The input parameter isn’t a valid dossier objectInvalid inputNative Embedding SDKCaught by the catch() of the promise object