Deleting a Product
Endpoint: DELETE /admin/products/{product_id}
Purpose
Deletes a specific product from the system based on its unique product ID. This action permanently removes the product, including all associated data such as pricing, inventory, and SEO configurations. It is typically used for removing obsolete, duplicate, or invalid product entries from the catalog.
Path Parameters
Parameter | Type | Description |
---|---|---|
product_id | Integer | The unique identifier of the product. |
Query Parameters
No query parameters for this endpoint.
Use Case
An admin decides to remove a discontinued product or clear out products that were mistakenly created. This endpoint ensures such clean-up operations can be performed efficiently through the admin interface or automated scripts.
Request Body
No data is required for the request body.
Response
Returns a 204 No Content
status, indicating that the product was successfully deleted. There is no response body, confirming the operation completed without errors or further data.
Deleting Product Images
Endpoints: DELETE /admin/products/{product_id}/images/{image_id}
Purpose
This endpoint allows administrators to permanently remove specific images associated with a product. It deletes both the original image and any generated thumbnail versions from the system storage while maintaining the integrity of the remaining product data.
Path Parameters
Parameter | Type | Description |
---|---|---|
product_id | Integer | The unique identifier of the product containing the image |
image_id | Integer | The unique identifier of the specific image to be deleted |
Query Parameters
No query parameters for this endpoint.
Use Case
Administrators use this endpoint when they need to remove outdated, incorrect, or unwanted product images while keeping the product record intact. Typical scenarios include deleting temporary placeholder images after adding final product photos, removing duplicate images, or cleaning up old product versions. The function targets specific images without affecting other media assets or product information, making it precise for media management operations.
Request Body
No data is required for the request body.
Response
The endpoint returns a 204 No Content
status upon successful deletion, indicating the image was removed without returning any data. The absence of content in the response confirms the operation was completed successfully while maintaining security by not exposing internal file system information.