This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a gallery item by ID.
function getGalleryItem(
identifiers: GetGalleryItemIdentifiers,
options: GetGalleryItemOptions,
): Promise<Item>;
Gallery ID and Item ID.
import { proGallery } from "wix-pro-gallery-backend";
/* Sample galleryId value: 'af5c3670-9b0f-4d86-b3b9-19fe62006c39'
*
* Sample itemId value: '813def66-0f0b-40b7-a9df-c731345a926f'
*/
export async function myGetGalleryItemFunction(galleryId, itemId) {
try {
const galleryItem = await proGallery.getGalleryItem({ galleryId, itemId });
const galleryItemId = galleryItem._id;
const galleryItemTitle = galleryItem.title;
console.log("Success! Got the gallery item:", galleryItem);
return galleryItem;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "_createdDate": "Mon Feb 20 2021 15:22:15",
* "_id": "813def66-0f0b-40b7-a9df-c731345a926f",
* "_updatedDate": Tue Mar 30 2021 15:23:22,
* "description": "This is the first item in my gallery.",
* "image": {
* "imageInfo": "wix:image://v1/38939f9568z222d6avc6285c9ac1e9129.jpg/38939f9568z222d6avc6285c9ac1e9129.jpg#originWidth=200&originHeight=199"
* }
* "sortOrder": 1657439075188
* "title": "My Gallery Item"
* "type": "IMAGE"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.