-
Notifications
You must be signed in to change notification settings - Fork 3
User Endpoint
Wiki ▸ Endpoints ▸ User
Contains data of all users available on our e-learning platform.
The User endpoint is a representation of the users added to the application. The endpoint's purpose is to facilitate accessing, creating, updating and deleting these resources.
Retrieves all of the available users.
Status code: 200
Body:
[
{
"id": "538228c9-7ee4-4bc8-a781-e483a7cec4f5",
"name": "Test User",
"username": "testEmail@yahoo.com",
"password": "$2a$10$UPNeB/dNFhkeCb1vgGjdz.yxo0.5lT8Y50QfMTx9mcXPTqRSCoGBC",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
},
{
"id": "38472327-38ab-4611-a645-1b572638917a",
"name": "Test User2",
"username": "testEmail2@yahoo.com",
"password": "$2a$10$BsMeB/dNFhkeCb1vgGjdz.yxo0.5lT8Y50QfMTx9mcXPTRg6b8J6q",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
},
]Retrieves the user with the provided id.
| Path Parameter | Description |
|---|---|
:id |
The id of the user entry. |
Status code: 200
Body:
{
"id": "538228c9-7ee4-4bc8-a781-e483a7cec4f5",
"name": "Test User",
"username": "testEmail@yahoo.com",
"password": "$2a$10$UPNeB/dNFhkeCb1vgGjdz.yxo0.5lT8Y50QfMTx9mcXPTqRSCoGBC",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
}Status code: 404
Body:
{
"error": "Not Found"
}Retrieves the user with the provided username.
| Query Parameter | Required/Optional | Description | Type |
|---|---|---|---|
username |
Required | The username of the user entry |
String |
Status code: 200
Body:
{
"id": "538228c9-7ee4-4bc8-a781-e483a7cec4f5",
"name": "Test User",
"username": "testEmail@yahoo.com",
"password": "$2a$10$UPNeB/dNFhkeCb1vgGjdz.yxo0.5lT8Y50QfMTx9mcXPTqRSCoGBC",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
}Status code: 404
Body:
{
"error": "Not Found",
}Retrieves the users with the provided role.
| Path Parameter | Description |
|---|---|
:role |
The role of the user entry. |
Status code: 200
Body:
[
{
"id": "54c303ff-f0dc-42ba-aea8-76ece1bb148c",
"name": "Test User2",
"username": "testEmail2@yahoo.com",
"password": "$2a$10$6d6pjjsiADouY9ORv6iP6.b6XHmtjOxiCnskjQLwKs95vEcry3cqS",
"roles": []
},
{
"id": "538228c9-7ee4-4bc8-a781-e483a7cec4f5",
"name": "Test User",
"username": "testEmail@yahoo.com",
"password": "$2a$10$UPNeB/dNFhkeCb1vgGjdz.yxo0.5lT8Y50QfMTx9mcXPTqRSCoGBC",
"roles": []
},
]Status code: 200
Body:
[]Offers a new access token for authorization based on the Refresh Token.
Status code: 200
Body:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0RW1haWxAeWFob28uY29tIiwicm9sZXMiOlsiUk9MRV9TVFVERU5UIl0sImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTAwMC91c2Vycy90b2tlbi9yZWZyZXNoIiwiZXhwIjoxNjMzMDE3MzYxfQ.fv72Zm24IF-RETNaJVkbR4iCIYMLD6-RU2KrPEpTYKw",
"refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0RW1haWxAeWFob28uY29tIiwicm9sZXMiOlsiUk9MRV9TVFVERU5UIl0sImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTAwMC91c2Vycy9sb2dpbiIsImV4cCI6MTYzMzAxNzM2MX0.kG_iDzDUzgq3QVfIbibyFMrgAWgd0ucPmnQvMC-SCC0"
}Adds an entry composed in the body as a user.
If the name, username or roles attribute is null or empty, it will return an error. The password attribute needs to be at least 8 characters and contain at least one small letter, one capital letter, one number and one special character.
Status code: 201
Request Body:
{
"name": "Test User3",
"username": "testEmail2@yahoo.com",
"password": "!TestPassword1234",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
}Response Body:
{
"id": "2e221cf4-baeb-497d-b32b-baa5d1cc416a",
"name": "Test User3",
"username": "testEmail2@yahoo.com",
"password": "$2a$10$B59JymHGywXcpETqr/7F5Orhc75ihtSnpggb864/7f.9voJxq..8q",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
}Status code: 400
Request Body:
{
"name": "",
}Response Body:
{
"error": "POST: User Invalid Name",
}Status code: 400
Request Body:
{
"username": "already.used@username.com",
}Response Body:
{
"error": "POST: Username already used",
}Status code: 400
Request Body:
{
"username": "",
}Response Body:
{
"error": "POST: User Invalid Username",
}Status code: 400
Request Body:
{
"roles": "",
}Response Body:
{
"error": "POST: User Invalid Roles",
}Status code: 400
Request Body:
{
"password": "",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "test",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "testpassword",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "Testpassword",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "Testpassword1234",
}Response Body:
{
"error": "POST: User Invalid Password",
}Registers a new User with the default role.
If the name or username is null or empty, it will return an error. The password attribute needs to be at least 8 characters and contain at least one small letter, one capital letter, one number and one special character.
Status code: 201
Request Body:
{
"name": "Test User4",
"username": "testEmail3@yahoo.com",
"password": "!TestPassword1234"
}Response Body:
{
"id": "f1a1c2e0-6591-47f3-b9d9-3a4a2386164c",
"name": "Test User4",
"username": "testEmail3@yahoo.com",
"password": "$2a$10$bRm6.9m2H/temPq7t8mgzeTQ5udk5wRovdO2yIMZQBhOzMXMpRdca",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
}Status code: 400
Request Body:
{
"name": "",
}Response Body:
{
"error": "POST: User Invalid Name",
}Status code: 400
Request Body:
{
"username": "",
}Response Body:
{
"error": "POST: User Invalid Username",
}Status code: 400
Request Body:
{
"password": "",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "test",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "testpassword",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "Testpassword",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "Testpassword1234",
}Response Body:
{
"error": "POST: User Invalid Password",
}Logs an already existing user into the application.
If the credentials are incorrect, it will return an error.
Status code: 200
Request Body:
{
"username": "user@example.com",
"password": "pass"
}Response Body:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjcmlzdGkudmFsZW50aW4yOUBnbWFpbC5jb20iLCJyb2xlcyI6WyJST0xFX0FETUlOIiwiUk9MRV9TVFVERU5UIl0sImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTAwMC91c2Vycy9sb2dpbiIsImV4cCI6MTYzNDYyNTgzN30.U7YobbN9PHBfGxSELKHftPUpiyRhbvEHnml8rLT1wWw",
"refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjcmlzdGkudmFsZW50aW4yOUBnbWFpbC5jb20iLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAvdXNlcnMvbG9naW4iLCJleHAiOjE2MzQ2MjU4Mzd9.D0ZjbZ8X7kfWHpzKM7VINQrwXX5--kF8KE4kB99_iW4"
}Status code: 403
Request Body:
{
"username": "not@existing.com",
"password": "incorrectPass"
}Response Body:
{
"error_message": "Bad credentials"
}Sends an entity at the specified id with the user entry that has been updated.
| Path Parameter | Description |
|---|---|
:id |
The id of the user entry. |
Status code: 200
Request Body:
{
"name": "Modified User",
"username": "testEmail3@yahoo.com",
"password": "!TestPassword1234",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
}Response Body:
{
"id": "f1a1c2e0-6591-47f3-b9d9-3a4a2386164c",
"name": "Modified User",
"username": "testEmail3@yahoo.com",
"password": "$2a$10$uETw0AInKmLP04eZkxT49eJ8hEejLYUfi/C6IZnst3JedehqeI5Jq",
"roles": [
{
"id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
"name": "ROLE_STUDENT"
}
]
}Status code: 404
Request Body:
{
"name": "Bob",
"username": "bob@example.com",
"password": "thisIsNotASafePassword"
}Response Body:
{
"error": "Not Found",
}Status code: 400
Request Body:
{
"username": "testEmail@yahoo.com"
}Response Body:
{
"error": "POST: Username already used",
}Status code: 400
Request Body:
{
"name": ""
}Response Body:
{
"error": "POST: User Invalid Name",
}Status code: 400
Request Body:
{
"username": ""
}Response Body:
{
"error": "POST: User Invalid Username",
}Status code: 400
Request Body:
{
"password": ""
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"roles": ""
}Response Body:
{
"error": "POST: Role not found",
}Status code: 400
Request Body:
{
"password": "test",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "testpassword",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "Testpassword",
}Response Body:
{
"error": "POST: User Invalid Password",
}Status code: 400
Request Body:
{
"password": "Testpassword1234",
}Response Body:
{
"error": "POST: User Invalid Password",
}Deletes the user with the provided id.
| Path Parameter | Description |
|---|---|
:id |
The id of the user entry. |
Status code: 200
Body:
Status code: 404
Body:
{
"error": "Not Found",
}Wiki | Site | Project Roadmap | Figma