Search...
deleteGalleryItem( )
Developer Preview
Deletes a media item from a gallery.
Description
The deleteGalleryItem()
function returns a Promise that resolves to the ID of the deleted gallery item. When a gallery item is deleted, the deleted gallery item is no longer returned when calling the listGalleryItems()
function.
Override permissions
This function is restricted and only runs if you elevate permissions using the wix-auth
elevate()
function.
Warning: Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.
Syntax
function deleteGalleryItem(identifiers: DeleteGalleryItemIdentifiers): Promise<DeleteGalleryItemResponse>
deleteGalleryItem Parameters
NAME
TYPE
DESCRIPTION
identifiers
DeleteGalleryItemIdentifiers
Gallery ID and Item ID.
Returns
Return Type:
Promise<
DeleteGalleryItemResponse
>NAME
TYPE
DESCRIPTION
itemId
string
ID of the deleted media item.
Was this helpful?
Delete a gallery item
Copy Code
1import { proGallery } from 'wix-pro-gallery-backend';23/* Sample galleryId value: 'f7cca0a0-5bb5-44c2-a0f8-6496430b3154'4 *5 * Sample itemId value: '5f3eae0d-cd93-47f8-af56-1442f37cf9bf'6 */78export async function myDeleteGalleryItemFunction(galleryId, itemId) {9 try {10 const deletedGalleryItemId = await proGallery.deleteGalleryItem({galleryId, itemId});1112 console.log('Success! Deleted the gallery item:', deletedGalleryItemId);13 return deletedGalleryItemId;14 } catch (error) {15 console.error(error);16 // Handle the error17 }18}1920/* Promise resolves to:21 * {22 * "itemId": "5f3eae0d-cd93-47f8-af56-1442f37cf9bf"23 * }24 */25