-
Notifications
You must be signed in to change notification settings - Fork 7
delete users id
Harmun edited this page May 15, 2019
·
2 revisions
delete | /users/:id | Admin/User | Soft delete a user specified by id | None | { id, userName, role, dateCreated, deletedAt } |
Soft deletes a user specified by id. Their data is still kept in the database.
To restore a user, an admin can use the PUT user/:id endpoint.
- Users can only manipulate data for their own ID , unless they have the admin user role.
- Cannot restore a user.
Request formats | JSON |
Requires authentication? | Yes |
curl -X DELETE \
http://localhost:3000/users/2 \
-H 'Authorization: Bearer 123testtoken123' \
-H 'Host: localhost:3000'
After you delete a user you'll get back the soft-deleted user's information like this:
{
"id": 2,
"userName": "iGotSnapped",
"role": "user",
"dateCreated": "2019-05-14T10:17:46.000Z",
"deletedAt": "2019-05-14T15:49:45.000Z"
}