A delete method removes an existing resource. A standard operation targets the resource by unique identifier, uses HTTP DELETE, and normally returns an empty value after successful removal. section 7.2 section 7.3.7
Define the behavior explicitly before implementing the method:
- Decide whether deleting a missing resource reports the current result—already absent—or the action’s failure, such as 404 Not Found. section 7.2
- Choose whether repeated deletion is declarative and idempotent, or imperative and able to fail when the resource is already absent. section 7.3.7
- Distinguish authorization failures from nonexistence deliberately; returning 403 Forbidden or 404 Not Found affects information disclosure. section 7.2
- Support delete only where the resource model permits it; permanent or immutable resources can expose the method but reject attempts with 403 Forbidden. section 7.3.1
Deleting a chat room
A resource-oriented API can expose DeleteChatRoom with an identifier such as chatRooms/{id}. A successful hard delete makes the ChatRoom disappear and returns no resource payload. section 7.3.7
Listing 7.5 The standard delete method
abstract class ChatRoomApi {
@delete("/{id=chatRooms/*}") #1
DeleteChatRoom(req: DeleteChatRoomRequest): void; #2
}
interface DeleteChatRoomRequest {
id: string;
}
Inspect the compact method definition showing the HTTP DELETE path, identifier request, and void result. section 7.3.7
Soft deletion changes the operation from physical removal to marking the resource deleted. The method returns the modified resource, ordinary listing hides it, undelete restores it, and permanent removal requires a separate custom method. section 25.3 section 25.3.2







