Web SDK reference guide
This page outlines the changes in certain data objects, and in how those objects relate to others. For a higher-level explanation of these changes, check out the comparison guide.
window.miro
window.miro
The window.miro
object continues to be the root object of the Web SDK, serving as the main entry point to the SDK methods. All methods in this reference guide are referred to by their hierarchy following window.miro.**___**
.
Boards
At first glance, much of the v1 board object has changed. Despite this, working with a board object in the Miro Web SDK v2 should feel familiar. The structure of the board object is fundamentally the same between v1 and v2. While many methods were renamed for improved clarity, they behave in the same manner as in v1.
Creating a widget / item
The most significant change for board objects in the v2 Web SDK is the replacement of the board.widgets.create
method with individual constructors for each widget type.
In the Miro Web SDK v1, the widget methods were polymorphic – meaning that one method was used to interact with all potential widget types. The structure of the call would differ depending on what type of widget you were creating or updating. In the v2 SDK, we have replaced this with an independent constructor for each widget type. Widgets are now referred to as "items" and each item exists as its own object, rather than as a property of the board
.
The new item constructors should feel familiar to you, as they were designed to mostly follow the structure of the type-specific payloads of the previous board.widgets.create()
call. The following table provides a map of the v1 board.widgets.create
call for each supported widget type and its equivalent v2 item constructor.
Widget creation in v1 | Item creation in v2 |
---|---|
Not available in v1 |
|
|
|
|
|
Emoji
| Not currently available in v2 |
|
|
|
|
|
|
Preview creation was not supported in v1. |
|
|
|
|
|
|
|
Board properties
The table below provides a side-by-side comparison of each board
property in the v1 and v2 Web SDKs. The majority of the properties supported in v1 have been removed, and so we have tried to provide the reasoning behind those removals.
|
|
---|---|
|
|
|
|
| This has been removed as a property in v2, as explained above. Board items now exist as their own objects, separate from the board object. |
| This has been removed as a property in v2, as explained below. Tags now exist as their own objects, separate from the board object. |
| This has been removed in v2, as there is not a need for a dedicated namespace for board information. |
| In v2, this function is served by |
| This has been removed in v2, as there is not a need for a dedicated namespace for board utility functions. |
Board metadata / storage
In the v1 Web SDK, board.metadata
supported two experimental methods. Metadata was also sometimes referred to as "storage" and provided developers with a way to write a key-value data object into local storage.
Both of these endpoints have been upgraded and are now fully-supported in v2, and have been renamed for clarity.
board.metadata.get()
is nowboard.getAppData()
board.metadata.update()
is nowboard.setAppData()
The table below provides a side-by-side comparison of the usage of each method.
v1 method | v2 method |
---|---|
|
|
|
|
V2 also introduces support for item-level metadata. You can now set and get metadata that is associated with a particular item on the board:
setMetadata
board.setMetadata("key", value)
board.getMetadata("key")
Storage collection
In addition to app and item-level metadata, the V2 Web SDK introduces new support for Storage collection. This provide the ability to store, retrieve, and remove data from a specified collection using key value pairs.
Storage collection provides more storage capability than app and item-level metadata offers and enables you to build logic for when certain keys change (onValue listener).
For a full comparison of all supported metadata and storage options in the V2 Web SDK, see the Storage guide.
BoardUI
When building the v2 SDK, we decided to rethink the way we expose extension points. As a result of this design choice, we have removed several extension points that were available in v1.
Currently, developers building applications with the Miro v2 Web SDK have two options available: the app panel ("Panel") and the pop-up modal ("Modal"). The bottom bar and the left sidebar are no longer available.
The table below shows the board.ui
endpoints from v1 and their v2 counterparts, if available.
|
|
---|---|
|
|
|
|
|
|
|
|
| Not currently available in v2. |
| Not currently available in v2. |
| Not currently available in v2. |
| Not currently available in v2. |
| This method has been removed in v2, as the bottom bar is not currently available. |
V2 also introduces additional helper methods for understanding if modals or panels already open on a board. You can now check modal and panel statuses:
canOpenModal
board.ui.canOpenModal()
board.ui.canOpenPanel()
V2 also introduces new methods in board.ui
for manager the Z-index of an item. See getLayerIndex and its associated methods for more details on managing layers (Z-index) for items.
Events
The V2 Web SDK introduces new support for events which can be used trigger certain logic in an app. Events capture user actions, board changes, and more—enabling your app to respond to actions in Miro.
The V2 Web SDK supports events for:
- Board UI
- Collaboration
- Storage collection
- Timer
- Realtime
- Note: Realtime events are created and sent by the app developer
For more details on supported events, see the Events guide for a comparison between each type of supported event.
Viewport
In both the v1 and v2 Web SDKs, board.viewport
serves as the namespace for the collection of methods that interact with the current viewport. The viewport endpoints are largely unchanged, with one major exception: the three methods for controlling the zoom level of a viewport in v1 are no longer supported in v2.
See the table below for a full side-by-side comparison of each board.viewport
method and its usage across both v1 and v2.
|
|
---|---|
|
This method and its response are both unchanged between the v1 and v2 SDKs. |
ℹ️ Note:
|
|
|
This method is unchanged between the v1 and v2 SDKs. |
|
In the v2 Web SDK, |
|
To set the viewport with an animation in v2, include the option |
|
|
|
|
| Not available in v2 |
Widgets / Items
In the Miro Web SDK v1, the widget methods were polymorphic – meaning that one method was used to interact with all potential widget types. The structure of the call would differ depending on what type of widget you were creating or updating. In the v2 SDK, we have replaced this with independent endpoints for each item type. Widgets are now referred to as "items" and each item exists as its own object, rather than as a property of the board
object.
widgets.update()
and the new sync()
method
widgets.update()
and the new sync()
methodEvery item type has a sync()
method. All item updates are now handled through [item].sync()
rather than board.widgets.update()
. For more information on the sync()
method and an explanation of its usage, please refer to this guide.
The following table shows an example of updating the title of a card item in both v1 and v2.
Updating widgets in v1 | Updating items in v2 |
---|---|
|
|
board.widgets
endpoints
board.widgets
endpointsWith the removal of the board.widgets
property in the v2 Web SDK, the methods contained in the boards.widget
namespace have moved to the board
object in v2. The board.widgets.create()
and board.widgets.update()
methods are discussed separately in this guide, but the remaining methods can be found in the table below, side-by-side with their v2 counterparts.
v1 widget methods | v2 equivalents |
---|---|
|
or
The v2 SDK offers the same support as the v1 SDK for fetching items. The response can be all of the items on the board, one item specifically, or a subset of items matching a particular set of filters. Filters include item type, associated tags, etc. For more examples and a full reference of possible filters, please see the Web SDK reference documentation. |
|
ℹ️ Note:
|
|
ℹ️ Note:
|
|
ℹ️ Note:
|
|
|
| Not available in v2 |
| Not available in v2 |
Widget / Item properties
In the v2 Web SDK, each item type has its own defined set of properties, directly applicable to that item. These properties would include data unique to the item, such as the type of shape, or style options like color choices. Other properties are universal to all item types, such as geometry or positioning information.
The table below enumerates the various item properties as they exist in both v1 and v2, beginning with the universal properties, and then moving into type-specific properties.
Widget properties in v1 | Item properties in v2 |
---|---|
Basic information | |
|
|
|
|
|
|
Geometry / Position information | |
|
ℹ️ Note:
|
Type-specific information | |
|
ℹ️ Note:
|
|
|
|
ℹ️ Note:
|
|
|
|
|
|
|
|
|
|
ℹ️ Note:
|
|
|
"Unsupported" item types
For board items that are not yet supported in the Miro v2 Web SDK, there is an unsupported item type, which serves as a catch-all object. It does not offer any item-specific properties, but it does have a sync()
method. This allows applications to interact with unsupported board objects, including moving or relocating these objects.
Currently, the following item types are not yet supported in the v2 SDK.
We will be adding new item types over time, and we will continue to share updates as we make progress. There are several feature requests already noted on our roadmap, and we encourage you to add your votes and subscribe to future updates. You’re also welcome to raise any questions or concerns in our developer Discord or on our community forum.
Tags
As with the v1 board.widgets
property, board.tags
is no longer a supported property in the v2 SDK. Tags now exist as their own object, rather than as a property of the board
object.
Creating a tag
Although tags are not considered to be items on a Miro board, the new item constructor approach has also been used to create a tag constructor. A side-by-side comparison of the v1 and v2 constructions can be found in the table below.
Tag creation in v1 | Tag creation in v2 |
---|---|
|
|
Updating a tag
Similar to items, tag objects each have a sync()
method. All tag updates are now handled through [tag].sync()
rather than board.tags.update()
. For more information on the sync()
method and an explanation of its usage, please refer to this guide.
The following table shows an example of updating a tag in both v1 and v2.
Updating tags in v1 | Updating tags in v2 |
---|---|
|
|
Working with tags
Aside from the new create and update implementations, tags are similar across the v1 and v2 SDKs. The most significant change lies in how tags and items are associated. In the v1 Web SDK, a tag was assigned to a widget by adding the widget’s ID to the tag object. In the v2 Web SDK, this has been reversed to the more intuitive approach, where a tag’s ID is added to an item object.
For this, and other side-by-side comparisons of tags across v1 and v2, see the table below.
|
ℹ️ Note:
|
|
ℹ️ Note:
|
|
|
Info
In the Miro v1 Web SDK, board.info
served as the namespace for methods related to getting board information. However, there was only one supported method in this namespace: board.info.get()
.
This has been removed in v2, as there is not a need for a dedicated namespace for board information.
Board information can now be retrieved using the board.getInfo()
method, as shown in the table below. Unfortunately, the v2 board info object is pretty bare compared to its v1 counterpart. This is a known issue, and the board info objects have been included in the table below for clarity.
Board Info in v1 | Board Info in v2 |
---|---|
|
|
Board Info object properties
| Board Info object properties
|
Selection
In the v1 Web SDK, board.selection
served as the namespace for methods that interacted with the selection of certain widgets on the board. In v2, the equivalent methods are board.getSelection
, board.select
, and board.deselect
.
The table below provides a side-by-side comparison of the v1 board.selection
property and its v2 counterpart (if available).
Selections in v1 | Selections in v2 |
---|---|
|
|
| Not available in the v2 Web SDK |
|
|
|
|
Utils
In Web SDK v1, board.utils
served as the namespace for utility methods for a board. This property has been removed in v2, as there is not a need for a dedicated namespace for board utility functions.
Specifically, in the Web SDK v1, there was only one supported method in this namespace: board.utils.unionWidgetBounds()
. With Web SDK v2, the bounds
object is no longer a property of board items, rendering the sole utility method obsolete.
v1 | v2 |
---|---|
| Not available in the Web SDK v2 |
Web SDK v2 has, however, started to introduce some similar utility-type methods, such as findEmptySpace
. This method can be accessed from the experimental
namespace, and allows you to programmatically find empty space on a Miro board when positioning items. See findEmptySpace.
Users and Accounts
The v1 Web SDK offered several endpoints for working with users and accounts, including the UserInfo object, Account Info object, and several methods, including:
.account.get()
.currentUser.getScopes()
.currentUser.isSignedIn()
.currentUser.getCurrentBoardPermissions()
.currentUser.getCurrentAccountPermissions()
.currentUser.isMemberOfCurrentAccount()
None of these are available in the Miro v2 Web SDK. When building the v2 platform, all enterprise methods have been moved to the REST API. The Web SDK will no longer offer any endpoints that require a Team or Organization authorization scope.
However, applications can still retrieve the context and information of the current authenticated user by using board.getUserInfo()
. An example of this method, and its v1 counterpart, is provided in the table below.
v1 | v2 |
---|---|
|
ℹ️Note:
|
The V2 SDK also introduces a new method to retrieve users who are currently active on a board. See getOnlineUsers.
Additional capabilities in V2
There are several additional capabilities that are now supported in the V2 Web SDK, including:
- Mindmaps
- Collaboration and Session Management
- Storage
- Realtime Events
- Timer
- Group/Ungroup methods
- Additional shape types
- Enhanced image capabilities
- We now return the URL for all images on the board. This allows developers to download the image and perform other relevant tasks. For more information, see our Web SDK reference documentation on images.
- goToLink and linkedTo methods
- Custom Actions
- Layers (Z-Index)
We will continue to expand support for new capabilities in our V2 Web SDK. Stay up to date with our changelog for the latest developments.
New namespaces in V2
The V2 Web SDK introduces a couple of new namespaces.
Experimental
The experimental namespace, miro.board.experimental
, is where certain experimental features or methods will be exposed as an early preview. These methods should not be relied on in a production environment.
Features or methods that are experimental in v2 will be reflected with an experimental tag in the reference documentation.
Collaboration
The collaboration namespace, miro.board.collaboration
, is where new features or methods related to collaborative experiences will be exposed. See Collaboration.
V1 experimental methods
Some of the experimental methods from the v1 Web SDK are now fully supported in v2. For those that were not upgraded to become permanent parts of the v2 platform, we have removed the methods from our SDK. This is an attempt to clean up erroneous code, and to ensure a consistent developer experience.
The removed methods are listed below.
board.__getParamsFromURL()
board.widgets.__blinkWidget()
board.widgets.__getIntersectedObjects()
board.comments.get()
If any of these methods were critical to your v1 application, or if you have any other questions or concerns, please reach out. You can post in our community forum, start a discussion in our developer Discord, or suggest and vote on new features in our public roadmap.
Updated 3 months ago