MstrEnvironment class
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 dashboard API
Function
async loadDossier(props)
Input Parameters
Parameter Name | Data Type | Description | Is Required |
---|---|---|---|
props.projectId | String | The project ID, which must be a GUID. | true |
props.objectId | String | The dashboard ID, which must be valid. If the ID is a document, report, or bot ID, an error is reported. | true |
props.instanceId | String | The dashboard instance ID, if it already exists. | false |
props.applicationId | String | the dashboard application ID, if not specified, the default application will be used | false |
The projectId
+ objectId
is used as the dashboard 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.
},
});
// Begin here
const dossier = await environment.loadDossier({
projectId: "B19DEDCC11D4E0EFC000EB9495D0F44F",
objectId: "D9AB379D11EC92C1D9DC0080EFD415BB",
});
} catch (error) {
// Your own error handling logic
}
API Errors
Error Case | Error Category | Handling Module | Error Handling |
---|---|---|---|
The input parameter fails input validation | Invalid input | Native Embedding SDK | Caught by the catch() of the promise object |
Other REST API errors | Other | Native Embedding SDK | Caught by the catch() of the promise object |
The destroy dashboard API
Function
async unloadDossier(dossier)
Input Parameters
Parameter Name | Data Type | Description | Is Required |
---|---|---|---|
dossier | MstrDossier class | The MstrDossier object created by the loadDossier function | true |
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 Case | Error Category | Handling Module | Error Handling |
---|---|---|---|
The input parameter isn’t a valid dashboard object | Invalid input | Native Embedding SDK | Caught by the catch() of the promise object |
The load bot API
Function
async loadBot(props)
Input Parameters
Parameter Name | Data Type | Description | Is Required |
---|---|---|---|
props.projectId | String | The project ID, which must be a GUID. | true |
props.objectId | String | The bot ID, which must be valid. If the ID is a dashboard, document or report ID, an error is reported. | true |
props.applicationId | String | the bot application ID, if not specified, the default application will be used | false |
The projectId
+ objectId
is used as the bot identifier. If the function is called twice with the same parameter, the same MstrBot
object is returned in the callback.
Response
This API returns a promise object that resolves to a MstrBot
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.
},
});
// Begin here
const bot = await environment.loadBot({
projectId: "B19DEDCC11D4E0EFC000EB9495D0F44F",
objectId: "E9AB379D11EC92C1D9DC0080EFD415BB",
});
} catch (error) {
// Your own error handling logic
}
API Errors
Error Case | Error Category | Handling Module | Error Handling |
---|---|---|---|
The input parameter fails input validation | Invalid input | Native Embedding SDK | Caught by the catch() of the promise object |
Other REST API errors | Other | Native Embedding SDK | Caught by the catch() of the promise object |
The get authToken API
Function
getAuthToken()
Response
This API returns the authentication token obtained by the MstrEnvironment.
Example
try {
const environment = await microstrategy.embeddingComponent.environments.create({
serverUrl: "https://demo.microstrategy.com/MicroStrategyLibrary",
getAuthToken: () => {
// Logic similar to the existing Native Embedding SDK.
},
});
// Get authentication token
const authToken = environment.getAuthToken();
} catch (error) {
// Your own error handling logic
}