List of available endpoints:
-
POST /register -
POST /login -
POST /google-login -
GET /user -
GET /profile -
GET /profile/:username -
POST /profile -
PUT /profile -
GET /:username/message -
POST /:username/message -
DELETE /:id/message -
GET /group -
POST /group -
DELETE /group/:id
Register for user
- Body
{
"username": "Anonymous",
"email": "test10@mail.com",
"password": "password",
},
{
"username": "Anonymous",
"email": "test10@mail.com"
}{
"message": "Validation error"
}Login for user
- Body
{
"username": "Anonymous",
"email": "test10@mail.com",
},
{
"access_token": "string",
"id": "integer",
"username": "string"
}{
"message": "Invalid email/password"
}{
"message": "Validation error"
}Login for user with google account
- Body
{
"googleToken": "string"
},
{
"access_token": "string",
"id": "integer",
"username": "string"
}{
"message": "Unauthorized access"
}Get info of currently logged user
Request:
- headers:
{
"access_token": "string"
} {
{
"id": 29,
"username": "ajax22",
"email": "ajax200@mail.com",
"createdAt": "2024-03-15T02:03:10.758Z",
"updatedAt": "2024-03-15T02:03:10.758Z",
"Profile": {
"id": 13,
"UserId": 29,
"fullName": "aj2",
"profileImgUrl": "https://res.cloudinary.com/dkrchzi4b/image/upload/v1710496093/73ab2e9a-3f32-45b0-943a-1db5e5e47567.jpg.jpg",
"bio": "programmer",
"createdAt": "2024-03-15T07:46:01.491Z",
"updatedAt": "2024-03-17T01:49:13.766Z"
}
}
},
{
"message": "Unauthorized"
}Get info of all profiles
Request:
- headers:
{
"access_token": "string"
}[
{
"id": 1,
"UserId": 1,
"fullName": "Alice Wonderland",
"profileImgUrl": "https://lh3.googleusercontent.com/a/ACg8ocIFy8VDjwyn8dKokC8h5eP23XwauCwlAevWjrxOsSD5=s96-c",
"bio": "Hello, I am Alice!",
"createdAt": "2024-03-13T08:52:29.548Z",
"updatedAt": "2024-03-13T08:52:29.548Z",
"User": {
"id": 1,
"username": "Alice",
"email": "alice@example.com",
"createdAt": "2024-03-13T08:52:29.277Z",
"updatedAt": "2024-03-13T08:52:29.277Z"
}
},
{
"id": 2,
"UserId": 2,
"fullName": "Bob Doe",
"profileImgUrl": "https://th.bing.com/th/id/R.1871862d87bb8037d953317fb4497189?rik=MBf1NyuchSQUtQ&riu=http%3a%2f%2fwww.pngall.com%2fwp-content%2fuploads%2f5%2fProfile.png&ehk=Ouu2uMvvMPnkP1bdIY2BTAzbwhRoG9p03NUzbwGLhlg%3d&risl=&pid=ImgRaw&r=0",
"bio": "Hello, I am Bob!",
"createdAt": "2024-03-13T08:52:29.548Z",
"updatedAt": "2024-03-13T08:52:29.548Z",
"User": {
"id": 2,
"username": "Bob",
"email": "bob@example.com",
"createdAt": "2024-03-13T08:52:29.406Z",
"updatedAt": "2024-03-13T08:52:29.406Z"
}
}
]{
"message": "Unauthorized"
}Get info of profile based on username
Request:
- headers:
{
"access_token": "string"
}- params:
{
"username": "string"
}[
{
"id": 4,
"UserId": 3,
"fullName": "Charlie",
"profileImgUrl": "https://th.bing.com/th/id/R.1871862d87bb8037d953317fb4497189?rik=MBf1NyuchSQUtQ&riu=http%3a%2f%2fwww.pngall.com%2fwp-content%2fuploads%2f5%2fProfile.png&ehk=Ouu2uMvvMPnkP1bdIY2BTAzbwhRoG9p03NUzbwGLhlg%3d&risl=&pid=ImgRaw&r=0",
"bio": "i'm a web developer.",
"createdAt": "2024-03-13T12:05:03.622Z",
"updatedAt": "2024-03-13T14:07:48.994Z"
}
]{
"message": "Unauthorized"
}Create new profile for new user
Request:
- headers:
{
"access_token": "string"
}- Body
{
"profileImgUrl": "string",
"fullName": "string",
"bio": "string",
},
[{ "message": "Profile created Succesfully." }]{
"message": "Unauthorized"
}{
"message": "Validation error"
}Update profile
Request:
- headers:
{
"access_token": "string"
}- Body
{
"profileImgUrl": "Blob",
"fullName": "string",
"bio": "string",
},
[{ "message": "Profile created Succesfully." }]{
"message": "Unauthorized"
}Get private messages between two user (the currently logged one) and other user based on username
Request:
- headers:
{
"access_token": "string"
}- params:
{
"username": "string"
} {
"id": 824,
"SenderId": 29,
"ReceiverId": 2,
"text": "Test",
"createdAt": "2024-03-16T05:01:41.607Z",
"updatedAt": "2024-03-16T05:01:41.607Z",
"Sender": {
"username": "Anonim20",
"Profile": {
"profileImgUrl": "https://res.cloudinary.com/dkrchzi4b/image/upload/v1710496093/73ab2e9a-3f32-45b0-943a-1db5e5e47567.jpg.jpg",
"fullName": "Anonymous"
}
},
"messageBelongsToLoggedUser": true
},
{
"id": 870,
"SenderId": 29,
"ReceiverId": 2,
"text": "HeLLo",
"createdAt": "2024-03-16T11:54:36.719Z",
"updatedAt": "2024-03-16T11:54:36.719Z",
"Sender": {
"username": "Anonim20",
"Profile": {
"profileImgUrl": "https://res.cloudinary.com/dkrchzi4b/image/upload/v1710496093/73ab2e9a-3f32-45b0-943a-1db5e5e47567.jpg.jpg",
"fullName": "Anonymous"
}
},
"messageBelongsToLoggedUser": true
},{
"message": "Unauthorized"
}{
"message": "User not found."
}Send a private message between a user
Request:
- headers:
{
"access_token": "string"
}- body:
{
"text": "string"
}- params:
{
"username": "string"
}{
"id": 878,
"text": "a",
"SenderId": 29,
"ReceiverId": 2,
"updatedAt": "2024-03-17T04:50:28.694Z",
"createdAt": "2024-03-17T04:50:28.694Z"
}{
"message": "Unauthorized"
}{
"message": "User not found."
}Delete a private message between users, based on message id
Request:
- headers:
{
"access_token": "string"
}- params:
{
"id": "string"
}{ "message": "Message succesfully deleted." }{
"message": "Unauthorized"
}{
"message": "Message not found."
}Get all message in public group
Request:
- headers:
{
"access_token": "string"
}[
{
"id": 2,
"UserId": 2,
"GroupId": 1,
"text": "Hello Alice!",
"imgUploadGroup": null,
"createdAt": "2024-03-13T08:52:29.577Z",
"updatedAt": "2024-03-13T08:52:29.577Z",
"Group": {
"id": 1,
"name": "Public",
"createdAt": "2024-03-13T08:52:29.567Z",
"updatedAt": "2024-03-13T08:52:29.568Z"
},
"User": {
"username": "Bob",
"Profile": {
"id": 2,
"UserId": 2,
"fullName": "Bob Doe",
"profileImgUrl": "https://th.bing.com/th/id/R.1871862d87bb8037d953317fb4497189?rik=MBf1NyuchSQUtQ&riu=http%3a%2f%2fwww.pngall.com%2fwp-content%2fuploads%2f5%2fProfile.png&ehk=Ouu2uMvvMPnkP1bdIY2BTAzbwhRoG9p03NUzbwGLhlg%3d&risl=&pid=ImgRaw&r=0",
"bio": "Hello, I am Bob!",
"createdAt": "2024-03-13T08:52:29.548Z",
"updatedAt": "2024-03-13T08:52:29.548Z"
}
},
"messageBelongsToLoggedUser": false
},
{
"id": 1,
"UserId": 1,
"GroupId": 1,
"text": "Hello everyone in Group 1!",
"imgUploadGroup": null,
"createdAt": "2024-03-13T08:52:29.577Z",
"updatedAt": "2024-03-13T08:52:29.577Z",
"Group": {
"id": 1,
"name": "Public",
"createdAt": "2024-03-13T08:52:29.567Z",
"updatedAt": "2024-03-13T08:52:29.568Z"
},
"User": {
"username": "Alice",
"Profile": {
"id": 1,
"UserId": 1,
"fullName": "Alice Wonderland",
"profileImgUrl": "https://lh3.googleusercontent.com/a/ACg8ocIFy8VDjwyn8dKokC8h5eP23XwauCwlAevWjrxOsSD5=s96-c",
"bio": "Hello, I am Alice!",
"createdAt": "2024-03-13T08:52:29.548Z",
"updatedAt": "2024-03-13T08:52:29.548Z"
}
},
"messageBelongsToLoggedUser": false
}
]{
"message": "Unauthorized"
}Send a message to public group
Request:
- headers:
{
"access_token": "string"
}- Body
{
"imgUploadGroup": "string",
"text": "string",
},
{
"id": 543,
"UserId": 29,
"GroupId": 1,
"text": "test",
"imgUploadGroup": "https://i.imgur.com/WiRSHll.png",
"updatedAt": "2024-03-17T03:13:27.979Z",
"createdAt": "2024-03-17T03:13:27.979Z"
}{
"message": "Unauthorized"
}{
"message": "Validation error"
}Delete a message owned by user in public group
Request:
- headers:
{
"access_token": "string"
}- params:
{
"id": "string"
}{ "message": "Message succesfully deleted." }{
"message": "Unauthorized"
}{
"message": "Message not found."
}Response (500 - Internal Server Error)
{
"message": "Internal Server Error"
}