Skip to content

Users_get

Luigi Minardi edited this page Mar 3, 2022 · 2 revisions

Return to Users

Get all users

Return all the users of the database.

Endpoint: /
Request:

After being logged in, go to the endpoint and you'll get the response.

If you're using postman or insomnia to check the API remember to put the token of the logged user on the header, as Authorization: Bearer <token>.

Response Body:
Response code: 200
[
	{
		"id": 1,
		"name": "Adult",
		"age": 20,
		"surname": "User",
		"email": "adult@gmail.com",
		"nickname": "adult",
		"password": "$2b$10$ehA1HQZhz4k6cls.7iUb4.fzCPbGiD37/CPtPmKPTNDejcuWuXNXq",
		"isAdmin": true,
		"createdAt": "2022-02-26T20:12:57.000Z",
		"updatedAt": "2022-02-26T20:14:11.000Z"
	},
	{
		"id": 2,
		"name": "Underage",
		"age": 7,
		"surname": "User",
		"email": "kid@gmail.com",
		"nickname": "kid",
		"password": "$2b$10$4hmHZZ5cRarCMU7Vsvxtx.MPYjV0LB7YJXnAK.28jvsXfOyH7SaFS",
		"isAdmin": false,
		"createdAt": "2022-02-26T20:18:37.000Z",
		"updatedAt": "2022-02-26T20:18:37.000Z"
	}
]

Get user with given pk

Return the user with the passed pk.

Endpoint: /:pk
Request:

After being logged in, go to the endpoint and you'll get the response.

If you're using postman or insomnia to check the API remember to put the token of the logged user on the header, as Authorization: Bearer <token>.

Response Body:
Response code: 200
{
	"id": 1,
	"name": "Adult",
	"age": 20,
	"surname": "User",
	"email": "adult@gmail.com",
	"nickname": "adult",
	"password": "$2b$10$ehA1HQZhz4k6cls.7iUb4.fzCPbGiD37/CPtPmKPTNDejcuWuXNXq",
	"isAdmin": true,
	"createdAt": "2022-02-26T20:12:57.000Z",
	"updatedAt": "2022-02-26T20:14:11.000Z"
}