Skip to content

API Documentation: Delete Product Image

This API allows users with the appropriate permissions (such as vendors or vendor roles) to delete a specific product image based on the provided image_id. Users must be authorized to delete the image based on the product's vendor or shop association.

Endpoint

DELETE /api/v1/catalog/vendor/variant-image/delete/<str:image_id>/

URL Parameters

  • image_id (string): The ID of the product image to be deleted.

Example:

DELETE /api/v1/catalog/vendor/variant-image/delete/12345/

Permissions

  • The user must have either the Vendor role or a VendorRolePermissions role.
  • Only vendors or users with the VendorRolePermissions assigned can delete product images.

Allowed Roles:

  1. user: Cannot delete product images.
  2. vendor: Can delete product images for products owned by the vendor or the vendor's shop.
  3. vendor_role: Can delete product images for products belonging to the vendor assigned through VendorRolePermissions.

Role Restrictions

  • Users with the user role cannot perform deletion of product images.
  • Vendors can only delete images associated with products they own or products within their shop.
  • Vendor roles can delete images for products they are assigned to through VendorRolePermissions.

Responses

Success Response:

  • Status Code: 204 No Content
  • Response Body: json { "message": "Image deleted successfully." }