MicroStrategy ONE
mstr
After initialization, there is a global object, mstr, which represents the whole framework of the generic data connector. Customers use this object to interact with MicroStrategy.
createDataConnector
createDataConnector(): GenericDataConnector
The connector uses this function to get a GenericDataConnector object.
validateDataConnector
validateDataConnector(connector: GenericDataConnector): void
This function checks the validation of the connector and sets the connector to the mstr object if the connector is valid. Raises an exception if the connector is invalid. connector, passed in as a parameter, is the generic data connector created by createDataConnector.
submit
submit(): void
This function informs MicroStrategy that the connector has finished its work. This function also packages necessary information, like tableList, connectionData, authType, and so on, and sends it to MicroStrategy Web.
connectionData
connectionData: JSON object
The connector can put the customized parameters in this field. This information is passed to fetchTable in the fetch phase.
authType
authType: authTypeEnum
This field indicates the authentication type of the current connection of this connector. There are three types of authentication. See authTypeEnum.
tableList
tableList: array<TableSchema>
This field tells MicroStrategy how many tables should be fetched in the current connection. This field MUST be set before the connector calls submit(). Each element in tableList should be an object of TableSchema. (tableName is required.)
fetchURL
fetchURL: string
If the web data source can be downloaded from a specific URL, there is a simpler way to import data.
mstr.fetchURL = "http://example.com/data/mydata.csv";
...
mstr.submit();
After submit is invoked, MicroStrategy directly uses the URL specified in mstr.fetchURL to import data and does not execute the connector's Javascript code on the MicroStrategy server. The connector must define an empty fetchTable function because mstr.validateDataConnector checks for the existence of fetchTable and fails if it does not find this function.
fileType
fileType: string
File types supported by the Data Connector SDK supports file types, including txt, csv, json, excel and so on. The connector MUST tell MicroStrategy the file type in the current connection before submit is invoked. (The only exception is when fetchURL is used.) Currently, fileType must be one of the following:
- CSV
This is the default. If the connector does not set fileType, MicroStrategy will treat it as CSV. - EXCEL
- JSON
- FORMAT_JSON
This file type is used for data with schema that you define.
authenticationInfo
authenticationInfo: string
Customized authentication information. For example, the access token and the refresh token can be saved to this object for use in the fetch data phase.
connectionName
connectionName: string
Name ofthe current connection.
parameter
parameter: JSON object
This object represents the information entered when the user created the connector, such as clientId for OAuth connector. When a connector is registered, the developer can access this object through mstr.parameter.
phase
phase: phaseEnum
See phaseEnum.