IPA-108: Delete
In REST APIs, it is customary to make a DELETE request to a resource's URI
(for example, /groups/{groupId}/clusters/{clusterName}) to delete that
resource.
Guidance
APIs should provide a Delete method for resources unless it is not valuable for users to do so
- Read-only resources must not have a Delete method
- Singleton resources must not have a Delete method
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupCluster
responses:
"204":
description: The cluster was deleted.Why:The
clustersresource lets users remove a cluster, so it exposes a Delete method viaDELETEon the resource URI.For each resource in the spec, determine whether users need to delete instances of it.
Confirm the resource is neither read-only nor a singleton — both must not have a Delete method.
If deleting a resource is valuable for users, confirm the resource exposes a
DELETEmethod. Flag resources that omit it without a clear reason.
The HTTP verb must be
DELETEpaths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupCluster
responses:
"204":
description: The cluster was deleted.Why:The delete operation uses
DELETEon the resource URI, the HTTP verb defined for removing a resource.The response should be empty
- Empty response must return 204 No Content status
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupCluster
responses:
"204":
description: The cluster was deleted.Why:The delete operation returns an empty body with a
204 No Contentstatus, signaling success without returning a representation.For the delete operation, inspect the success response.
- Confirm the response has no body.
Confirm an empty response uses the
204 No Contentstatus code. Flag delete operations that return a body or a different success status.
The request must not include a body
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupCluster
parameters:
- name: clusterName
in: path
required: true
schema:
type: string
responses:
"204":
description: The cluster was deleted.Why:The delete operation identifies the resource entirely through the path and defines no
requestBody.The Delete method must succeed if and only if a resource was present and was successfully deleted
- If the resource did not exist, the method must respond with a
404 Not Founderror - The Delete method must not return a successful response while any of the resource's internal state remains — settings, policies, or configurations the client can only manage through the resource itself
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupCluster
responses:
"204":
description: The cluster and all of its internal state were deleted.
"404":
description: No cluster with that name exists.Why:The delete operation succeeds with
204only when the cluster existed and was fully removed, internal state included, and returns a404 Not Founderror when the resource was not present.paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupCluster
responses:
"204":
description: The cluster was deleted; its backup policy is retained.Why:The delete reports success while the cluster's backup policy — internal state the client can only manage through the cluster itself — survives. The resource is not fully gone, so a client cannot treat the
204as a clean teardown. The operation also omits404 Not Foundfor the absent-resource case.Delete a resource that exists and confirm the method succeeds.
Confirm no internal state of the resource — settings, policies, or configurations the client can only manage through the resource itself — survives the delete.
Issue the same delete against a resource that does not exist.
Confirm the second call responds with a
404 Not Founderror rather than reporting success.
- If the resource did not exist, the method must respond with a
Example
DELETE /groups/${groupId}/clusters/${clusterName}
Cascading Delete
Sometimes, it may be necessary for users to be able to delete a resource as well as all applicable child resources. However, since deletion is usually permanent, it is also important that users not do so accidentally, as reconstructing wiped-out child resources may be quite challenging.
The API must not automatically delete child resources when a parent resource is deleted.
{
"error": 400,
"reason": "Bad Request",
"detail": "Please delete all clusters in this project before deleting the project.",
"errorCode": "BAD_REQUEST",
"parameters": []
}Why:The API fails with a validation error if child resources are present, instead of deleting them. The validation should instruct the user which child resources to delete first.
For each Delete operation, determine whether the resource may have child resources.
If it can, read the Delete operation description and, where available, the handler source it maps to.
Determine whether the operation automatically deletes its child resources.
Report any Delete operation that automatically deletes child resources without a validation error and without explicit opt-in.
If an API allows deletion of a resource that may have child resources, the API should provide a
cascading=truequery parameter.paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupCluster
parameters:
- name: cascading
in: query
schema:
type: boolean
default: false
responses:
"204":
description: The cluster and its child resources were deleted.Why:The cluster may have child resources, so the delete operation exposes a
cascadingquery parameter that lets users explicitly opt in to deleting them.For each delete operation, determine whether the resource may have child resources.
If it can, confirm the operation exposes a
cascadingquery parameter.Flag delete operations on resources with children that omit the
cascadingparameter, forcing destructive deletes without an explicit opt-in.
Example
DELETE /groups/{groupId}/clusters/{clusterName}?cascading=true
Error Handling
See IPA-114: Errors for guidance on error handling and documentation.
Naming
Operation ID must be unique
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupClusterWhy:deleteGroupClusteris not reused by any other operation, so each operation in the spec has a distinct identifier.Operation ID must be in
camelCasepaths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupClusterWhy:deleteGroupClusteriscamelCase: lowercase first word, each subsequent word capitalized, no separators.Operation ID must start with the verb "delete"
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupClusterWhy:The operation ID begins with the verb
delete, identifying it as a delete method.Operation ID should be followed by a noun or compound noun
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupClusterWhy:The verb
deleteis followed by the compound nounGroupCluster, naming the resource being deleted.The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form
paths:
/groups/{groupId}/clusters/{clusterName}:
delete:
operationId: deleteGroupClusterWhy:The resource identifier
/groups/${groupId}/clusters/${clusterName}has collection identifiersgroupsandclusters; the operation ID uses their singular forms,GroupandCluster.
Examples:
| Resource Identifier | Operation ID |
|---|---|
/groups/${groupId}/clusters/${clusterName} | deleteGroupCluster |