API 06: Delete Product (Header ID)

Demonstration of deleting a resource using the **DELETE** method, with the ID passed via a **Header Parameter**.

🎯 Purpose for OutSystems Tutorial

This API is the final REST CRUD operation and showcases a unique input method. It shows how to:

🔗 API Endpoint Details

Method:

DELETE

Endpoint URL:

http://api.ankitg.in/api/delete-product.php

Required Header Parameter:

Parameter Name Type Location Description
X-Product-ID Integer Header The ID of the product to be deleted.

💬 Expected Responses

A. Success Response (200 OK) - Item Deleted

Returns a confirmation message upon successful deletion.

{
    "status": "Success",
    "message": "Product ID 102 deleted successfully."
}
            

B. Failure Response (404 Not Found) - ID Not Found

{
    "error": "Resource not found",
    "message": "Product with ID 999 not found for deletion."
}
            

💡 Important for Tutorial Video!

To demonstrate the **impact** of this API call:
  1. In OutSystems, **read the full list** of products using **GET** (API 1). Show product 102 exists.
  2. Call this **DELETE** API, passing ID 102 in the header.
  3. **Read the full list** again using **GET** (API 1). Show that product 102 is now permanently removed from the list (due to the session persistence).
▶️ Watch the Tutorial on DELETE Operations!