User¶
In this section you can find, examples of HTTP requests and responses for managing users
Create New¶
# Http requestPOST
http://localhost:8080/api/user
HTTP/1.1
Request¶
Header:
¶Authorization : Bearer {jwt.token}
Content-Type : application/json
Body:
¶{
"email": "test@gmail.com",
"password":"1234",
"userGroup": 2,
"userDetail": {
"name": "Unit",
"surname": "Test",
"phoneNumber": "+99830 302 03 23",
"department": "Tester",
"organisation": "TestGmbH",
"salutation": "Salutations"
}
}
Response¶
Success:
userGroup.icon could be null
or can hold a link
if userGroup icon is set.
userDetail.profilePicture will be null becouse image will be set by another request.
Body:
¶{
"enhanceId": 14,
"email": "test1@gmail.com",
"userGroup": [
{
"enhanceId": 38,
"role": "USER_ROLE",
"description": "User role",
"icon": null,
"components": [
{
"enhanceId": 1,
"name": "TRANSACTION",
"description": "Transaction description",
"permissions": [
"READ",
"DELETE",
"CREATE",
"UPDATE"
]
},
{
"enhanceId": 2,
"name": "CONNECTOR",
"description": "Connector description",
"permissions": [
"READ",
"CREATE"
]
}
]
}
],
"userDetail": {
"name": "John",
"surname": "Doe",
"phoneNumber": "+99830 302 03 23",
"department": "Manager",
"organisation": "Org",
"salutation": "I freez you!",
"profilePicture": null,
"requestTime": null
}
}
Error:
Body:
¶{
"timestamp" : "2018-05-24T12:44:26.295+0000",
"status" : 500,
"error" : "Internal Error",
"message" : "CREATION_ERROR",
"success" : "false",
"path" : "/api/user"
}
Upload Profile Picture of User¶
Before sending request for uploding User Profile Picture, you have to send request for Creating User! After this opertaion you can send request for uploading profile picture.
# Http request for picture uploadPOST
http://localhost:8080/api/storage/profilePicture
HTTP/1.1
Header:
¶Authorization : Bearer {jwt.token}
Content-Type : multipart/form-data
After user has been created, you will get an email of user.
Body: |
|
---|---|
Key | Value |
file | { uploaded file } |
{ user email } |
If error will occur you will get response
.
Error:
Header:
¶Internal Error 500
Body:
¶{
"timestamp" : "2018-05-24T12:44:26.295+0000",
"status" : 500,
"error" : "Internal Error",
"message" : "WRONG_FORMAT",
"success" : "false",
"path" : "/api/storage/{profilePicture}"
}
Get All¶
# Http requestGET
http://localhost:8080/api/user/all
HTTP/1.1
Response¶
Success:
Body:
¶{
"_embedded" : {
"userResources" : [
{
"enhanceId" : 1,
"email" : "admin@gmail.com",
"userGroup" : [
{
"name" : "ROLE_ADMIN",
"description" : "Administrator role",
"icon" : "http://localhost/resource/icon_hat.png",
"components" : [
{
"name" : "TRANSACTION",
"description" : "Manages transactions",
"permissions" : [
"READ",
"DELETE",
"CREATE",
"UPDATE"
]
},
{
"name" : "USER",
"description" : "Gets component for user management",
"permissions" : [
"READ",
"CREATE"
]
}
]
}
],
"userDetail" : {
"name" : "Unit",
"surname" : "Test",
"phoneNumber" : "+99830 302 03 24",
"department" : "Tester",
"organisation" : "TestGmbH",
"salutation" : "Salutations",
"profilePicture" : "http://localhost/resource/profile.png",
"requestTime" : "2018-10-05T03:24:59.000+0000"
}
},
{
"enhanceId": 2,
"email": "user@gmail.com",
"userGroup": [
{
"enhanceId" : 2,
"name" : "ROLE_USER",
"description" : "Administrator role",
"icon" : "http://localhost/resource/icon_hat.png"
"components" : [
{
"name" : "USER",
"description" : "Gets component for user management",
"permissions" : [
"READ",
"CREATE"
]
}
]
}
],
"userDetail" : {
"name" : "User",
"surname" : "UserName",
"phoneNumber" : "+99830 302 03 23",
"department" : "Users",
"organisation" : "Locta",
"salutation" : "Salutations",
"profilePicture" : "http://localhost/resource/profile.png",
"requestTime" : "2018-10-05T03:24:59.000+0000"
}
}
]
}
}
Error:
Body:
¶ {
"timestamp" : "2018-05-24T12:44:26.295+0000",
"status" : 500,
"error" : "Authorization error",
"message" : "ACCESS_DENIED",
"success" : "false",
"path" : "/api/user/all"
}
Get One¶
# Http requestGET
http://localhost:8080/api/user/{userId}
HTTP/1.1
Response¶
Success:
Body:
¶{
"enhanceId" : 2,
"email" : "user@gmail.com",
"userGroup" : [
{
"enhanceId" : 2,
"name" : "ROLE_USER",
"description" : "Administrator role",
"icon" : "http://localhost/resource/icon.png",
"components" : [
{
"enhanceId" : 1,
"name" : "USER",
"description" : "Gets component for user management",
"permissions" : [
"READ",
"CREATE"
]
}
]
}
],
"userDetail" : {
"name" : "User",
"surname" : "UserName",
"phoneNumber" : "+99830 302 03 23",
"department" : "Users",
"organisation" : "Locta",
"salutation" : "Salutations",
"profilePicture" : "http://localhost/resource/profile.png",
"requestTime" : "180092832"
}
}
Error:
Body:
¶{
"timestamp" : "2018-05-24T12:44:26.295+0000",
"status" : 500,
"error" : "Wrong header credentials"
"message" : "ACCESS_DENIED",
"success" : "false",
"path" : "/api/user/{userId}"
}
Change Password¶
# Http requestPUT
http://localhost:8080/api/user/{userId}/password
HTTP/1.1
Change Detail¶
# Http requestPUT
http://localhost:8080/api/user/{userId}/userDetail
HTTP/1.1
Request¶
profilePicture
should be set to null
.
Header:
¶Authorization : Bearer {jwt.token}
Content-Type : application/json
Body:
¶{
"enhanceId": 1,
"name": "Unit",
"surname": "Test",
"phoneNumber": "+99830 302 03 24",
"department": "Tester",
"organisation": "TestGmbH",
"salutation": "Salutations",
"profilePicture" : null,
"requestTime" : "180092832"
}
if you want to update profilePicture
you have to send following request:
# Http request for picture uploadPOST
http://localhost:8080/api/storage/profilePicture
HTTP/1.1
Header:
¶Authorization : Bearer {jwt.token}
Content-Type : multipart/form-data
Body: |
|
---|---|
Key | Value |
file | { uploaded file } |
{ user email } |
Response¶
Success:
Header:
¶201 Created
Body:
¶{
"enhanceId": 1,
"name": "John",
"surname": "Doe",
"phoneNumber": "+99830 302 03 23",
"department": "Manager Admin test",
"organisation": "Mason",
"salutation": "I freez you!",
"profilePicture": "http://localhost:8080/api/storage/files/d93ea7c0-dd24-4ea9-b40f-cbb43a9b3e21.jpg",
"requestTime": "2018-07-05T08:10:42.000+0000"
}
Error:
Body:
¶{
"timestamp" : "2018-05-24T12:44:26.295+0000",
"status" : 500,
"error" : {
"message" : "Forbidden"
},
"success" : "false",
"path" : "/api/user/storage/profilePicture"
}
Change User Group¶
# Http requestPUT
http://localhost:8080/api/user/{userId}/userGroup
HTTP/1.1
Delete¶
# Http requestDELETE
http://localhost:8080/api/user/{userId}
HTTP/1.1