Remove Reaction
Remove a reaction from a post or comment. The backend uses api/Post/{postId}/reactions for posts; comment reaction removal may use api/Comment or a dedicated Reaction endpoint.
Endpoints
Post reaction
DELETE /api/Post/{postId}/reactions
Comment reaction
DELETE /api/Comment/{commentId}/reactions
(or equivalent Reaction API if implemented)
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| postId | GUID | Post | Post ID (for post reactions) |
| commentId | string | Comment | Comment ID (for comment reactions) |
Response
Success (200 OK)
{
"success": true,
"message": "Reaction removed successfully"
}
Error (404 Not Found)
{
"success": false,
"error": {
"code": "REACTION_NOT_FOUND",
"message": "No reaction found"
}
}
Example
// Remove reaction from post
const response = await fetch(`http://localhost:5000/api/Post/${postId}/reactions`, {
method: 'DELETE',
headers: { 'Authorization': `Bearer ${token}` }
});
// Remove reaction from comment
const response = await fetch(`http://localhost:5000/api/Comment/${commentId}/reactions`, {
method: 'DELETE',
headers: { 'Authorization': `Bearer ${token}` }
});
Notes
- Only the user who created the reaction can remove it
- Removing a reaction updates the reaction counts immediately
- No error is returned if the reaction doesn't exist (idempotent)