git clone https://github.com/sozgat/messenger.git
cd messenger
docker-compose up
User information management and check user info
Singup with username and password
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/api/v1/user
Body:
{
"username":"armut",
"password":"123456"
}
Response:
{
"status": "success",
"phrase": "OK",
"timestamp": "06-09-2021 02:04:11",
"data": {
"username": "armut",
"token": null,
"tokenExpiryDate": null
}
}
You can list users.
Endpoint:
Method: GET
URL: http://localhost:8080/api/v1/user
Response:
{
"status": "success",
"phrase": "OK",
"timestamp": "06-09-2021 02:05:33",
"data": [
{
"username": "said",
"token": "99e167e2-3ea7-4164-acd6-f55b9f9fe89b",
"tokenExpiryDate": "2021-10-05T21:58:21"
},
{
"username": "armut",
"token": null,
"tokenExpiryDate": null
}
]
}
Login with username and password
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/api/v1/user/login
Body:
{
"username":"armut",
"password":"123456"
}
Response:
{
"status": "success",
"phrase": "OK",
"timestamp": "06-09-2021 02:06:55",
"data": {
"username": "armut",
"token": "9fb0177b-ed3f-41d9-902e-38dc8afe35cb",
"tokenExpiryDate": "2021-10-05T23:06:55.562"
}
}
Messages management services. You have to use Bearer Token for authorization and every message API in Postman.
Send message with toUsername and yourMessage
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/api/v1/message
Header:
Authorization:Bearer 9fb0177b-ed3f-41d9-902e-38dc8afe35cb
Body:
{
"username":"said",
"message":"hi said, i'm armut :)"
}
Response:
{
"status": "success",
"phrase": "OK",
"timestamp": "06-09-2021 02:18:01",
"data": {
"fromUsername": "armut",
"toUsername": "said",
"yourMessage": "hi said, i'm armut :)",
"messageCreatedTime": "2021-09-05T23:18:01.561"
}
}
List of your messaging users
Endpoint:
Method: GET
Type: RAW
URL: http://localhost:8080/api/v1/message/userlist
Header:
Authorization:Bearer 9fb0177b-ed3f-41d9-902e-38dc8afe35cb
Response:
{
"status": "success",
"phrase": "OK",
"timestamp": "06-09-2021 02:22:50",
"data": [
"said"
]
}
You can get all messages between auth user and user who auth user is messaging.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/api/v1/message/mymessages
Header:
Authorization:Bearer 9fb0177b-ed3f-41d9-902e-38dc8afe35cb
Body:
{
"username":"said"
}
Response:
{
"status": "success",
"phrase": "OK",
"timestamp": "06-09-2021 02:24:17",
"data": [
{
"fromUsername": "armut",
"toUsername": "said",
"yourMessage": "hi said, i'm armut :)",
"messageCreatedTime": "2021-09-05T23:18:02"
}
]
}
You can block the user you don't want to receive messages from.
Endpoint:
Method: POST
Type: RAW
URL: http://localhost:8080/api/v1/block
Header:
Authorization:Bearer 9fb0177b-ed3f-41d9-902e-38dc8afe35cb
Body:
{
"blockedUsername":"said"
}
Response:
{
"status": "success",
"phrase": "OK",
"timestamp": "06-09-2021 02:30:49",
"data": {
"blockingUsername": "armut",
"blockedUsername": "said"
}
}