Skip to content

get users

Harmun edited this page May 15, 2019 · 3 revisions

get /users/ User Return all users in bulk None { id, userName, dateCreated }

GET users

Returns all existing users in the database as an array.
Currently no pagination exists for this feature.

See GET users/:id for getting a single user.

Restrictions

  • Deleted users are ignored.
  • Can only be used by the admin role

Resource Information

Response formats JSON
Requires authentication? Yes, admin only

Example Request

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

Example Response

Users are returned as an array like this:

[
  {
      "id": 1,
      "userName": "loki",
      "dateCreated": "2019-05-14T10:00:48.000Z",
      "deletedAt": null,
      "role": "admin",
      "pssword": "$hashedpassword$"
  },
  {
      "id": 2,
      "userName": "SteveRogers1918",
      "dateCreated": "2019-05-14T10:01:56.000Z",
      "deletedAt": null,
      "role": "user",
      "pssword": "$hashedpassword$"
  },
  {
      "id": 3,
      "userName": "ThorSonOfOdin",
      "dateCreated": "2019-05-14T10:12:24.000Z",
      "deletedAt": null,
      "role": "user",
      "pssword": "$hashedpassword$"
  },
  {
      "id": 4,
      "userName": "notASpy",
      "dateCreated": "2019-05-14T10:17:46.000Z",
      "deletedAt": null,
      "role": "user",
      "pssword": "$hashedpassword$"
  },
  {
      "id": 5,
      "userName": "billionareplayboyphilanthropist",
      "dateCreated": "2019-05-14T12:40:09.000Z",
      "deletedAt": null,
      "role": "user",
      "pssword": "$hashedpassword$"
  }
]
Clone this wiki locally