DELETE /api/v1/departments/15
Basic rules:
- You must use HTTP DELETE method for deleting a resource.
- End point should be single (if not exceptional scenario e.g. Bulk delete)
- Proper http response codes must be returned
- Generally request has no body because identifier in route locates a resource to delete.
Http response codes to return
HTTP Code | When to return |
---|---|
200 - OK | When api delete a complete resource successfully. |
400 - Bad request | When api fails to invalid identifier is sent through request. e.g. if identifier is numeric and you pass negative value. |
404 - Not found | When resource you are looking for does not exist |
No comments:
Post a Comment