The DELETE HTTP request method are used to remove a resource instance or an entire resource collection from the server. The resource may be permanently deleted or may be marked as deleted (aka “soft delete”).
Details
Successful DELETE requests often return an HTTP status code of 200 (OK) with a body that may include a representation of the deleted resource, or a 204 (No Content) if there is no content to send in the response.
Common Use Cases
- Removing a resource such as a user, file, or database entry.
- Deleting temporary resources created for a session.
Examples
DELETE /users/123deletes the user with the ID of 123, if it exists.DELETE /session/456could be used to end a user session (signout) and delete all associated data.