Introduction

The Wix Dashboard API allows the code for dashboard pages created in the Wix Editor or with Wix Blocks to interact with the Wix dashboard environment.

Using the module you can:

  • Navigate users to other pages in the dashboard.
  • Display toast notifications at the top of the dashboard. Toast notification
  • Retrieve data about changes to the dashboard's state and use it to update your page in real time.
  • Request user confirmation before they leave the page.

To use the Wix Dashboard API, import the applicable function from wix-dashboard:

Copy
1

Before you begin

It's important to note that the Wix Dashboard API can only be used in code running on dashboard pages. The functions in this API don't work in backend code or on any other pages on your site.

Dashboard permissions

When you call Wix APIs from your dashboard page code, you need to keep in mind which permissions are available to your code. These permissions are different for dashboard pages created in the Editor and pages created with Wix Blocks.

Pages created in the Editor

Permissions for code running on dashboard pages created in the Editor are scoped to the currently logged-in user. This means that if your code makes calls to APIs that the user does not have permissions to access, those calls will fail.

For example, your dashboard page code may make a call to the stores API to add products to the site's store. However, if the user accessing the page has a role that doesn't allow adding products, those API calls will fail.

Pages created with Wix Blocks

Dashboard pages created with Wix Blocks are always part of an app. The code on these pages can access APIs with the permissions of the currently logged-in user, but only if the app has also been granted those permissions.

For example, if your app has permissions to add products to a store, but the current user does not, your app will not be able to use the stores API to add products to the store. Conversely, if the current user has permissions to add products to a store, but your app does not, your app will not be able to add products to the store. The only way your app can add products to a store is if both your app and the current user have permissions to do so.

Was this helpful?
Yes
No