The Pro Gallery API allows you to manage pro galleries on a Wix site's backend.
With the Pro Gallery API, you can:
- Get, list, and update pro galleries created by a Wix site owner with the Editor.
- Get, list, create, update, and delete items in a pro gallery.
- Create or delete a pro gallery on a site's backend.
For the Pro Gallery API to synchronize with a site's frontend, a Wix site owner needs to add a pro gallery to their site using the Editor. When you use the Pro Gallery API to create, update, or delete an item from a pro gallery created with the Editor, or to delete a pro gallery, the site's frontend updates automatically.
Note: We do not recommend creating new pro galleries using the Pro Gallery API. When a Wix site owner adds a pro gallery to their site using the Editor, a corresponding pro gallery is created on the site's backend. You can then use the Pro Gallery API to manage items in this pro gallery or delete it, and all updates are reflected on the site's frontend. However, when you create a pro gallery using the Pro Gallery API, it's available only on the site's backend and doesn't appear on the live site. In order to display a backend pro gallery on a live site, the site owner needs to connect it manually to a gallery component using code. To learn more about how a site owner can do this using Velo, see Displaying a Pro Gallery on Your Site Using the Pro Gallery Backend API.
It's important to note the following points before starting to code:
- We recommend using the Pro Gallery API for managing pro galleries that the site owner already created using the Editor.
- Read more about how site owners can manage their Pro Galleries.
- The Gallery Created and Gallery Updated webhooks don't return the media items included in the gallery. To retrieve these items or their IDs, listen to the Gallery Item Created and Gallery Item Updated webhooks.
- Pro Gallery: A responsive and customizable gallery that displays media items.
- Gallery Items: Media items in a pro gallery, such as images, videos, and text files. You can read more about supported media.
This article shares some possible use cases for your app, as well as an example flow that could support each one. You're certainly not limited to these use cases, but they can be a helpful jumping-off point as you plan your app's implementation.
Your app can help the site owners upload media from a Pro Gallery to an external Social Media platform to increase their brand's popularity. You could retrieve the site's Pro Galleries, let the site owner select one, get the relevant media, and then upload the media items to the external platform.
- Retrieve the site's Pro Galleries via the List Galleries endpoint.
- Display the first image of each gallery to the site owners and let them select which Pro Gallery they want to upload to the external platform.
- Retrieve the media items belonging to the relevant gallery using the Get Gallery endpoint.
- Create a mapping for future syncs between the Pro Gallery and the external platform and store it on your servers.
- Upload the media files to the external platform.
Note: Make sure to include both the Wix media item IDs and the external media IDs in the mapping.
First, your app needs to create a mapping between the Wix media items and the external media. You can read about a possible way to do so in the Share a Pro Gallery on an External Platform example flow.
- Sign up for the following webhooks:
- Get notified when one of these webhooks is triggered and extract the item ID from the webhook data.
- For the Gallery Item Updated and Gallery Item Created webhooks, also extract the media URL, sort order, and other relevant information.
- Identify the corresponding media item in your mapping and update the mapping accordingly.
- Use the external platform's APIs to create, delete, or update the media item there.
Note: Ignore the resulting webhook, so you don’t create an endless loop of updates.
- Listen to changes in the external gallery.
- Update the mapping according to the changes.
- Upload media to Wix Media using the Media Manager API.
- Create, update, or delete the relevant media item in the Pro Gallery using the matching endpoint.
- Ignore the resulting Wix webhook, so you don’t create an endless loop of updates.
Note: If you assign the same sort order index to more than one gallery, the function fails.
Retrieves a list of galleries.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Creates a new gallery.
Note: When you create a new gallery with Create Gallery, the newly-created gallery is available only on a site's backend and doesn't appear on the live site. To display a backend gallery on a live site, the site owner needs to connect it manually to a gallery component. To learn more about how a site owner can do this using Velo, see Displaying a Pro Gallery on Your Site Using the Pro Gallery Backend API.
You can create an entirely new gallery, or clone an existing gallery using the cloneFromGalleryId
parameter.
When a gallery is cloned, the newly-created gallery includes the same properties as the existing gallery except for the gallery IDs, item IDs, sort order, and created and updated dates.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Gets a gallery by ID.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Deletes a gallery.
Notes:
- The deleted gallery appears as an empty widget on the live site.
- The deleted gallery is no longer retrieved when calling the List Galleries endpoint.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Retrieves a list of media items in a specified gallery.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Creates a media item in a specified gallery.
Note: When creating or updating image items in a pro gallery, the images must be uploaded or imported to the Wix Media Manager first, as the
imageInfo
parameter currently only supports the Wix Media URL.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Gets a gallery item by ID.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Deletes a media item from a gallery.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Updates a gallery.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Updates a media item in a specified gallery.
Note: When creating or updating image items in a pro gallery, the images must be uploaded or imported to the Wix Media Manager first, as the
imageInfo
parameter currently only supports the Wix Media URL.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Triggered when a gallery is created.
Note: The event data doesn't include gallery items or their IDs. To receive information about the created items you need to listen to the Gallery Item Created webhook.
Event Body
Triggered when a gallery is updated.
Note: The event data doesn't include gallery items or their IDs. To receive information about the updated items you need to listen to the Gallery Item Updated webhook.
Event Body
Triggered when a gallery is deleted.
Event Body
Triggered when a media item in a specified gallery is created.
Event Body
Triggered when a media item in a specified gallery is updated.
Event Body
Triggered when a media item in a specified gallery is deleted.
Note: The event is triggered when a gallery item is deleted individually and when a gallery item is deleted because its gallery is deleted. The property
originatedFrom
has the valueGallery Deleted
if the entire gallery is deleted. If the gallery item is deleted individually, this field is empty.