Class OptimizeApiClient

Description

The high-level API client for Optimize.

Example

const optimize = new OptimizeApiClient()

async function main() {
await optimize.enableSharing()
const id = "8a7103a7-c086-48f8-b5b7-a7f83e864688"
const res = await optimize.exportDashboardDefinitions([id])
fs.writeFileSync('exported-dashboard.json', JSON.stringify(res, null, 2))
}

main()

Hierarchy

  • OptimizeApiClient

Constructors

  • Example

    const optimize = new OptimizeApiClient()
    

    Parameters

    • Optional userAgent: string

      An optional custom string to add to the user-agent for API calls

    Returns OptimizeApiClient

Properties

getHeaders: any
gotOptions: any
userAgentString: any

Methods

  • Description

    The report deletion API allows you to delete reports by ID from Optimize.

    Camunda 8 documentation

    Example

    const client = new OptimizeApiClient()
    client.deleteReport("e6c5aaa1-6a18-44e7-8480-d562d511ba62")

    Parameters

    • reportId: string

      The ID of the report you wish to delete

    Returns Promise<string>

  • Description

    This API allows users to disable the sharing functionality for all reports and dashboards in Optimize.

    Note that this setting will be permanently persisted in memory and will take precedence over any other previous configurations (e.g. configuration files).

    When sharing is disabled, previously shared URLs will no longer be accessible. Upon re-enabling sharing, the previously shared URLs will work once again under the same address as before. Calling this endpoint when sharing is already disabled will have no effect.

    Camunda 8 Documentation

    Example

    const client = new OptimizeApiClient()
    client.disableSharing()

    Returns Promise<Response<string>>

  • Description

    This API allows users to enable the sharing functionality for all reports and dashboards in Optimize.

    Note that this setting will be permanently persisted in memory and will take precedence over any other previous configurations (e.g. configuration files).

    If sharing had been previously enabled and then disabled, re-enabling sharing will allow users to access previously shared URLs under the same address as before. Calling this endpoint when sharing is already enabled will have no effect.

    Camunda 8 Documentation

    Example

    const client = new OptimizeApiClient()
    client.enableSharing()

    Returns Promise<Response<string>>

  • Description

    This API allows users to export dashboard definitions which can later be imported into another Optimize system.

    Note that exporting a dashboard also exports all reports contained within the dashboard. The dashboards to be exported may be within a Collection or private entities, the API has access to both.

    The obtained list of entity exports can be imported into other Optimize systems either using the dedicated import API or via UI.

    Camunda 8 Documentation

    Example

    const client = new OptimizeApiClient()
    const dashboardDefs = await client.exportDashboardDefinitions(["123", "456"])

    Parameters

    • dashboardIds: string[]

      Array of dashboard ids

    Returns Promise<any[]>

  • Description

    This API allows users to export report definitions which can later be imported into another Optimize system. The reports to be exported may be within a collection or private entities, the API has access to both.

    The obtained list of entity exports can be imported into other Optimize systems either using the dedicated import API or via UI.

    Camunda 8 Documentation

    Example

    const client = new OptimizeApiClient()
    const reportDefs = await client.exportReportDefinitions(["123", "456"])

    Parameters

    • reportIds: string[]

      array of report IDs

    Returns Promise<any[]>

  • Description

    The data export API allows users to export large amounts of data in a machine-readable format (JSON) from Optimize.

    Example

    const client = new OptimizeApiClient()
    const exporter = client.exportReportResultData("e6c5aaa1-6a18-44e7-8480-d562d511ba62")
    const page1 = await exporter.next()

    Parameters

    • reportId: string
    • Optional limit: number
    • Optional paginationTimeoutSec: number

    Returns ReportDataExporter

  • Description

    This API allows users to retrieve all dashboard IDs from a given collection.

    The response contains a list of IDs of the dashboards existing in the collection with the given collection ID.

    Camunda 8 Documentation

    Example

    const client = new OptimizeApiClient()
    const dashboardIds = await client.getDashboardIds(1234)

    Parameters

    • collectionId: number

      The ID of the collection for which to retrieve the dashboard IDs.

    Returns Promise<DashboardCollection>

  • Description

    The purpose of Health-Readiness REST API is to return information indicating whether Optimize is ready to be used.

    Camunda 8 Documentation

    Example

    const client = new OptimizeApiClient()
    try {
    await client.getReadiness()
    console.log('Ready!')
    } catch (e: any) {
    console.log('Error calling readiness point: ' + e.code)
    }

    Returns Promise<unknown>

  • Description

    This API allows users to retrieve all report IDs from a given collection. The response contains a list of IDs of the reports existing in the collection with the given collection ID.

    Camunda 8 Documentation

    Example

    const client = new OptimizeApiClient()
    const reports = await client.getReportIds(1234)

    Parameters

    • collectionId: number

      the id of the collection

    Returns Promise<ReportCollection>

  • Description

    This API allows users to import entity definitions such as reports and dashboards into existing collections. These entity definitions may be obtained either using the report or dashboard export API or via the UI.

    Camunda 8 Documentation

    Example

    const entities = [
    {
    "id": "61ae2232-51e1-4c35-b72c-c7152ba264f9",
    "exportEntityType": "single_process_report",
    "name": "Number: Process instance duration",
    "sourceIndexVersion": 8,
    "collectionId": null,
    "data": {...}
    },
    {
    "id": "b0eb845-e8ed-4824-bd85-8cd69038f2f5",
    "exportEntityType": "dashboard",
    "name": "Dashboard 1",
    "sourceIndexVersion": 5,
    "reports": [
    {
    "id": "61ae2232-51e1-4c35-b72c-c7152ba264f9",
    ...
    }
    ],
    "availableFilters": [...],
    "collectionId": null
    }
    ]
    const client = new OptimizeApiClient()
    await client.importEntities(123, entities)

    Parameters

    • collectionId: number
    • entities: any

    Returns Promise<EntityImportResponse>

  • Description

    With the external variable ingestion API, variable data held in external systems can be ingested into Optimize directly, without the need for these variables to be present in your Camunda platform data. This can be useful when external business data, which is relevant for process analysis in Optimize, is to be associated with specific process instances.

    Especially if this data changes over time, it is advisable to use this REST API to persist external variable updates to Optimize, as otherwise Optimize may not be aware of data changes in the external system.

    Example

    const variables = [
    {
    "id": "7689fced-2639-4408-9de1-cf8f72769f43",
    "name": "address",
    "type": "string",
    "value": "Main Street 1",
    "processInstanceId": "c6393461-02bb-4f62-a4b7-f2f8d9bbbac1",
    "processDefinitionKey": "shippingProcess"
    },
    {
    "id": "993f4e73-7f6a-46a6-bd45-f4f8e3470ba1",
    "name": "amount",
    "type": "integer",
    "value": "500",
    "processInstanceId": "8282ed49-2243-44df-be5e-1bf893755d8f",
    "processDefinitionKey": "orderProcess"
    }
    ]
    const client = new OptimizeApiClient()
    client.ingestExternalVariable(variables)

    Parameters

    Returns Promise<unknown>

  • Description

    With the variable labeling endpoint, variable labels can be added, updated, and deleted from Optimize.

    Camunda 8 Documentation

    Example

    const variableLabels =  {
    "definitionKey": "bookrequest-1-tenant",
    "labels" : [
    {
    "variableName": "bookAvailable",
    "variableType": "Boolean",
    "variableLabel": "book availability"
    },
    {
    "variableName": "person.name",
    "variableType": "String",
    "variableLabel": "first and last name"
    },
    {
    "variableName": "person.hobbies._listSize",
    "variableType": "Long",
    "variableLabel": "amount of hobbies"
    }
    ]
    }
    const client = new OptimizeApiClient()
    await client.labelVariables(variableLabels)

    Parameters

    Returns Promise<unknown>

Generated using TypeDoc