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
Vendorrole or aVendorRolePermissionsrole. - Only vendors or users with the
VendorRolePermissionsassigned can delete product images.
Allowed Roles:
- user: Cannot delete product images.
- vendor: Can delete product images for products owned by the vendor or the vendor's shop.
- vendor_role: Can delete product images for products belonging to the vendor assigned through
VendorRolePermissions.
Role Restrictions
- Users with the
userrole 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." }