RESTful DELETE Operation with Path Parameters
Description
This query demonstrates the standard RESTful DELETE operation pattern in Stack9, showcasing how to remove records through the API layer. The query uses the HTTP DELETE method with a path parameter to identify the record to be deleted. Unlike direct SQL DELETE statements, this approach goes through the Stack9 API layer, which typically performs a soft delete by setting the _is_deleted flag rather than physically removing the record from the database.
The simplicity of this query structure belies its importance in maintaining data integrity and audit trails. By using the API endpoint for deletion, the operation triggers any configured business rules, validations, and cascade operations defined at the entity level. The soft delete approach ensures that records can be recovered if needed and maintains referential integrity across related entities. This pattern is particularly important in enterprise systems where data retention and audit requirements prevent permanent deletion.
The empty body parameters ({}) in the DELETE request is a REST convention indicating that no request body is needed for the operation. The entire operation is idempotent, meaning multiple DELETE requests for the same ID will have the same effect as a single request. This pattern exemplifies Stack9's adherence to RESTful principles while providing enterprise-grade data management capabilities through soft deletes and proper audit trails.
Use Case
Used when removing alternative addresses from a customer's profile, such as when a customer no longer wants a secondary delivery address or when cleaning up duplicate or outdated address entries in the system.
Key Features
- Standard RESTful DELETE operation following HTTP conventions
- Path parameter interpolation for resource identification
- Soft delete implementation preserving data for audit trails
- API-level processing ensures business rules are enforced
- Idempotent operation safe for retry scenarios
- Cascade handling for related records configured at entity level
Query Type
DELETE
JSON Definition
{
"key": "deletealternativeaddress",
"name": "deleteAlternativeAddress",
"connector": "stack9_api",
"queryTemplate": {
"method": "delete",
"path": "/alternative_address/{id}",
"bodyParams": "{}",
"pathParams": {
"id": "{{id}}"
}
},
"userParams": {}
}
Notes
- This performs a soft delete by default, setting
_is_deleted = truerather than removing the record - The empty object
{}in bodyParams is required even though no body is sent - Soft deletes allow for data recovery and maintain audit trails for compliance
- Related records may be cascade-deleted based on entity configuration
- Consider implementing an "undelete" or "restore" operation for soft-deleted records
- The API may perform authorization checks to ensure the user can delete the record
- For bulk deletions, consider implementing a separate endpoint that accepts multiple IDs
- Physical deletion (if needed) typically requires database-level operations or scheduled cleanup jobs