Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ For information on new releases of the Extensibility API see:

## Introduction

Extensions are self-contained modules which users can add to Studio Pro. This means that with extensibility you can add new features and functionality to Studio Pro. The Extensibility API is an API that allows developers to interact with a curated list of internal systems of Studio Pro. This documentation provides guides and reference documentation for the Extensibility API.
Extensions are self-contained modules that enhance Studio Pro by adding new features and functionality. The Extensibility API allows developers to interact with a curated set of internal systems, making it easier to customize and expand Studio Pro’s capabilities.

The API is provided in two flavors, depending which language you are developing in. C# and web based (via Typescript):
The API is provided in two sections, depending on the language you are developing in:
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,32 @@ url: /apidocs-mxsdk/apidocs/extensibility-api-11/packaging-your-extension
weight: 30
---

# Packaging your extension
# Packaging Your Extension

Once you have finished development on your extension, you might want to package it into an add-on module so that others can start using it. Once you have created the add-on module, it can then be published to the Mendix Marketplace for your extension users to download into their Studio Pro app.
After completing development on your extension, you can package it into an add-on module so others can use it. Once packaged, the module can be published to the Mendix Marketplace, allowing other users to download it into their Studio Pro apps.

To package your extension, you will still need the `--enable-extension-development` command line option turned on. Create a new module in your Studio Pro app containing your dev extension, give it an appropriate name. Open the module's settings form and set it to be an Add-on module. In the `Extension name` dropdown, select the extension you want to package into it.
To package your extension, follow the steps below:

1. Make sure the`--enable-extension-development` command-line option is enabled.
2. In your Studio Pro app, create a new module and include your development extension.
3. Give the module a name.
4. Open the module's settings and in the **Export** tab, choose **Add-on module**.
5. In the **Extension name** drop-down, select the extension you want to package into it.

![Extension Add-on Module](/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensionAddOnModule.png)

After you've created your add-on module with its extension, you can now export it, by right-clicking the module in the App Explorer and choosing `Export add-on module package`, as shown below.
After you have created your add-on module with its extension, you can export it by right-clicking the module in the **App Explorer** and selecting **Export add-on module package**.

![Export Module](/attachments/apidocs-mxsdk/apidocs/extensibility-api/exportAddOnModule.png)

You can now save the add-on module to a location of your choice.

# Importing the extension add-on module
# Importing the Extension Add-on Module

Once the add-on module is available to a Studio Pro user, they are now able to add it in their application. They can so so by right-clicking the app in the App Explorer and choosing `Import module package`, as shown below.
When the add-on module is available to a Studio Pro user, they are now able to add it in their application. This is done by right-clicking the app in the **App Explorer** and selecting **Import module package**.

![Import Module](/attachments/apidocs-mxsdk/apidocs/extensibility-api/importAddOnModule.png)

Once an add-on module containing an extension is imported in the app, Studio Pro will show a warning to the user, asking to trust the extension contained in it. If the user does not choose to trust, the module will still be imported but the extension inside it won't be loaded.
When an add-on module containing an extension is imported in the app, Studio Pro will show a warning to the user, asking to trust the extension contained in it. If the user does not choose to trust, the module will still be imported but the extension inside it will not be loaded.

![Trust Extension](/attachments/apidocs-mxsdk/apidocs/extensibility-api/trustExtension.png)
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@ weight: 20

## Introduction

Extensions can be written in Typescript or other web languages, described here, or using a C# API which is documented separately in [Extensibility API for C# Developers](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/).
Extensions can be written in TypeScript or other web languages, described here, or using a C# API, which is documented in [Extensibility API for C# Developers](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/).

{{% alert color="info" %}}
Please note that extension development is only possible by starting Studio Pro with the `--enable-extension-development` feature flag.
At this time, extension development is only possible with the `--enable-extension-development` feature flag.
{{% /alert %}}

For more detailed information on the web API, see the [Mendix Studio Pro Web Extensibility API reference documentation](http://apidocs.rnd.mendix.com/11/extensions-api/index.html).

## Prerequisites

* You need at least a basic understanding of the Mendix platform.
* You need some understanding of the Mendix Model.
* You need to have some TypeScript development experience.
To use the Web Extensibility API, you must have:

* A basic understanding of the Mendix platform
* Some understanding of the Mendix Model
* Some TypeScript development experience

## Getting Started

For detailed explanation on how to get started with extensions, check out [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/).
For detailed information on how to get started with extensions, see [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/).

## How-tos

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ weight: 2

## Introduction

Studio Pro extensions can be developed using TypeScript and use standard web development technologies to extend the Studio Pro development environment. This guide shows you how to set up a basic development environment for building an extension using the web extensibility API.
Studio Pro extensions can be developed using TypeScript and use standard web development technologies to extend the Studio Pro development environment. This document describes how to set up a basic development environment for building an extension using the web extensibility API.

For more detailed information, see the [Mendix Studio Pro Web Extensibility API reference documentation](http://apidocs.rnd.mendix.com/11/extensions-api/index.html).

Expand All @@ -16,11 +16,11 @@ For more detailed information, see the [Mendix Studio Pro Web Extensibility API
You will need the following prerequisites:

* [Mendix Studio Pro](https://marketplace.mendix.com/link/studiopro) version 11.2.0 or higher.
* A development IDE to develop your extensions. We recommend using [Visual Studio Code](https://code.visualstudio.com/).
* Install the latest version 22.x.x of Node: https://nodejs.org/en/download.
* A development IDE to develop your extensions. Mendix recommends using [Visual Studio Code](https://code.visualstudio.com/).
* The latest version 22.x.x of Node: https://nodejs.org/en/download.

{{% alert color="info" %}}
Extensions can be built on any operating system as the underlying framework is cross-platform.
Extensions can be built on any operating system, as the underlying framework is cross-platform.
{{% /alert %}}

{{% alert color="info" %}}
Expand All @@ -35,28 +35,26 @@ This section will show you how to build and test an extension.

Create a new app using the **Blank Web App** template.

{{% alert color="info" %}}
You can also open the application directory containing the application `.mpr` file by clicking the **App** menu > **Show App Directory in Explorer** (or **Show App Directory in Finder**) in Studio Pro.
{{% /alert %}}

### Creating the Extension

To accelerate your extension development, we provide an extension generator that creates a customizable sample extension.
To accelerate your extension development, Mendix provides an extension generator that creates a customizable sample extension.

To use the generator, navigate to your desired source code directory and run the command `npm create @mendix/extension`. You may be prompted by `npm` to grant permission to install the generator. After installation, you will be guided through a series of questions to help configure your extension.

You will be asked the following:

* Select the programming language (TypeScript is used in our tutorials)
* Select the programming language (TypeScript is used in the tutorials)
* Specify the extension name
* Choose if you will use React for the extension’s UI
* Choose if you will use React for the extension’s UI

The next two questions, while optional, are highly recommended, as they enable direct debugging and deployment from Visual Studio Code.
The next two questions, while optional, are highly recommended, as they enable direct debugging and deployment from Visual Studio Code:

* Specify the path to the Studio Pro executable (this allows Visual Studio Code to automatically attach to Studio Pro for debugging)
* Specify the location of the application `.mpr` package. (This allows for automatic deployment of your extension build to your app)
* Specify the location of the application `.mpr` package (this allows for automatic deployment of your extension build to your app)

The final question allows you to select the Studio Pro version you are targeting; we recommend you choose version 11.
The last question allows you to select the Studio Pro version you are targeting; Mendix recommends choosing version 11.

{{% alert color="info" %}}
On a Windows machine, the Studio Pro executable is typically located at `C:\Program Files\Mendix\<version>\modeler\studiopro.exe`. To find the exact path, follow these steps:
Expand Down Expand Up @@ -155,17 +153,8 @@ If the last two questions of the extension generator were answered and you have

This will run Studio Pro in extension development mode and open the configured application. You will see a new `Extensions` item in the top menu.

## Conclusion

Using this guide we have:

* Created a new app
* Used the extension generator to get started with extension development
* Built the extension and installed it in our app
* Tested and debugged our extension from within Visual Studio Code

## Extensibility Feedback

If you would like to provide us with some additional feedback you can complete a small [Survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback)
If you would like to provide additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback).

Any feedback is much appreciated.
Any feedback is appreciated.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ url: /apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/

## Introduction

This how-to describes how to interact with the App Explorer in Studio Pro.
This how-to describes how to interact with the App Explorer in Studio Pro. In this example, you create a menu which will show for each microflow in the App Explorer.

## Prerequisites

This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Please complete that how-to before starting this one. You should also be familiar with command registration as described in [Register a Command Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/command-api/).
Before starting this how-to, make sure you have completed the following prerequisites:

* This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Complete that how-to before starting this one.
* Make sure you are familiar with command registration, as described in [Register a Command Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/command-api/).

## Creating a Context Menu

In this example, you will create a menu which will show for each microflow in the App Explorer. Use the full name of the document type to specify which type of document a menu should belong to (for example, `Microflows$Microflow` for microflows or `Pages$Page` for pages). The documentation for these document type names can be found at [Access a Mendix Model Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/model-api/).
{{% alert color="info" %}}
Use the full name of the document type to specify which type of document a menu should belong to (for example, `Microflows$Microflow` for microflows or `Pages$Page` for pages). For more information about these document type names, see [Access a Mendix Model Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/model-api/).
{{% /alert %}}

The code below does the following:

Expand Down Expand Up @@ -55,12 +60,8 @@ The payload of the command must be an object containing a document Id (`{ docume
The command must be registered before creating the menu.
{{% /alert %}}

## Conclusion

You have seen how to create context menus for a document node in the App Explorer. The menu executes a previously registered command.

## Extensibility Feedback

If you would like to provide us with additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback).
If you would like to provide additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback).

Any feedback is appreciated.
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ This how-to describes how to register a command in Studio Pro from an extension.

## Prerequisites

This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Please complete that how-to before starting this one. You should also be familiar with creating menus as described in [Create a Menu Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/menu-api/).
Before starting this how-to, make sure you have completed the following prerequisites:

* This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Complete that how-to before starting this one.
* Make sure you are familiar with creating menus as described in [Create a Menu Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/menu-api/).

## Register Commands

The Commands API allows users to register a reusable command. These commands can be attached to menus and context menus. At this time, two APIs make use of this feature:
The Commands API allows you to register a reusable command that can be attached to menus and context menus. At this time, two APIs support this feature:

* [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/)
* [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/)

To register commands, you can call the Commands API `registerCommand`.

In the sample code below, we register a command, then attach it to a menu by setting the property `commandId` to the `Menu` object.
## Using `registerCommand` API

{{% alert color="info" %}}
The `registerCommand` requires a generic type for the command payload once executed. For standalone menus that have a command without payload, you can register it with `<void>`. When using `void`, the generic type declaration can also be left out (for example, `registerCommand<void>(commandId...)` becomes `registerCommand(commandId...)`).
{{% /alert %}}
To register commands, use the Commands API `registerCommand`.

For commands that require payload, you must make sure you register the command with the exact expected payload object type. See the [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) and [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/) documentation for clear examples.
In the sample code below, we register a command, then attach it to a menu by setting the property `commandId` to the `Menu` object.

```typescript
import { ComponentContext, IComponent, Menu, StudioProApi, getStudioProApi } from "@mendix/extensions-api";
Expand Down Expand Up @@ -55,20 +54,30 @@ export const component: IComponent = {
}
```

It is also possible to create a context menu that belongs to a document in the App Explorer or a document editor, and that menu can have a registered command attached to it. To do so, you can use the [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) or the [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/).
## Payloads

The `registerCommand` requires a generic type for the command payload once executed.

* For commands without payload, use `<void>`. When using `void`, the generic type declaration can also be left out (for example, `registerCommand<void>(commandId...)` becomes `registerCommand(commandId...)`).
* For commands that require payload, make sure the payload type matches the expected structure.

The command registration for commands that interact with documents are slightly different. They require a payload of type `{ documentId: string }`; the backend will return the menu when it is clicked. The `documentId` is the id of the exact document that was interacted with by the menu.
See the [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) and [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/) documentation for examples.

## Context Menu Integration

{{% alert color="info" %}}
The command must be registered before creating any menus that might be attached to it.
{{% /alert %}}

## Conclusion
You can attach registered commands to context menus in:

* [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/)
* [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/).

You have seen how to register commands that can be attached to menus in Studio Pro.
The command registration for commands that interact with documents require a payload of type `{ documentId: string }`. The `documentId` is the id of the exact document that was interacted with by the menu. The backend will return the menu when it is clicked.

## Extensibility Feedback

If you would like to provide us with additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback).
If you would like to provide additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback).

Any feedback is appreciated.
Loading