-
Notifications
You must be signed in to change notification settings - Fork 2
RESTful API C2
annypanny edited this page Nov 29, 2016
·
10 revisions
/comments/[comment_id]/destroy
- It used to delete a author's own comments for the given comment_id on the server.
- The server return a message.
Method:
DELETE
Example:
GET /comments/837e4ede-231c-48bb-af23-441ecf0154c2/destroy
HTTP 405 Method Not Allowed
Allow: DELETE, OPTIONS
Content-Type: application/json
Vary: Accept
{
"detail": "Method \"GET\" not allowed."
}
if you are not the comment's author, it would return:
DELETE /comments/837e4ede-231c-48bb-af23-441ecf0154c2/destroy
HTTP 403 Forbidden
Allow: DELETE, OPTIONS
Content-Type: application/json
Vary: Accept
{
"detail": "You cant modify a comment that is not yours"
}
if you are the comment's owner, after the comment deleted, it would return:
DELETE /comments/837e4ede-231c-48bb-af23-441ecf0154c2/destroy
HTTP 204 No Content
Allow: DELETE, OPTIONS
Content-Type: application/json
Vary: Accept