Skip to content

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 }

DELETE users/:id

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.

Restrictions

  • Users can only manipulate data for their own ID , unless they have the admin user role.
  • Cannot restore a user.

Resource Information

Request formats JSON
Requires authentication? Yes

Example Request

curl -X DELETE \
  http://localhost:3000/users/2 \
  -H 'Authorization: Bearer 123testtoken123' \
  -H 'Host: localhost:3000'

Example Response

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"
}