API Documentation - jedipw/backend-healjai GitHub Wiki
HealJai API Documentation
Get isPsychiatrist
Get a boolean value which determines whether the user is a psychiatrist or not.
URL
GET api/getIsPsychiatrist
REQUEST PARAMS
| Parameter | Type | Description |
|---|---|---|
| userId | string | User ID |
Success
Response
| Parameter | Type | Description |
|---|---|---|
| isPsychiatrist | boolean | A boolean value which determines whether the user is a psychiatrist or not |
Example
{
"isPsychiatrist": true
}
Fail
Response
Status Code
500 Failed to retrieve user data
Create user chat message
Create a new user chat message.
URL
POST api/createUserChatMessage
REQUEST BODY
| Parameter | Type | Description |
|---|---|---|
| userId | string | User ID |
| text | string | Text |
Success
Response
Status Code
200 Message sent successfully
Fail
Response
Status Code
500 Failed to send message
Create psychiatrist chat message
Create a new psychiatrist chat message.
URL
POST api/createPsychiatristChatMessage
REQUEST BODY
| Parameter | Type | Description |
|---|---|---|
| senderId | string | Sender's User ID |
| tagNumber | string | Receiver's Tag Number |
| text | string | Text |
Success
Response
Status Code
200 Message sent successfully
Fail
Response
Status Code
500 Failed to send message
Get user chat
Get a specific user's chat
URL
GET api/getUserChat
REQUEST PARAMS
| Parameter | Type | Description |
|---|---|---|
| currentUserId | string | The ID of the current user |
| tagNumber | string | Receiver's Tag Number |
| isPsychiatrist | boolean | A boolean value which determines whether the user is a psychiatrist or not |
Success
Response
Status Code
200 Success
| Parameter | Type | Description |
|---|---|---|
| ChatInfo | Object[] | Chat info |
Example
[
{
"message": "Hello!",
"sender": "You",
"time": "10:30 AM",
"date": "Today",
"read": true,
"profilePic": ""
},
{
"message": "Hi there!",
"sender": "User",
"time": "10:35 AM",
"date": "Today",
"read": false,
"profilePic": ""
}
]
Fail
Response
Status Code
500 Failed to get user chat
Get all chat
Get all chat
URL
GET api/getAllChat
REQUEST PARAMS
| Parameter | Type | Description |
|---|---|---|
| currentUserId | string | The ID of the current user |
Success
Response
Status Code
200 Success
| Parameter | Type | Description |
|---|---|---|
| ChatInfo | Object[] | Chat info |
Example
[
{
"userName": "User #123",
"sender": "You",
"message": "Hello, how are you?",
"time": "Yesterday",
"isRead": true,
"userId": "abc123"
},
{
"userName": "User #456",
"sender": "Dr. Smith",
"message": "Good evening!",
"time": "Monday",
"isRead": false,
"userId": "def456"
},
]
Fail
Response
Status Code
500 Failed to get all chat
Get user ID from tag
Get user ID from tag
URL
GET api/getUserIdFromTag
REQUEST PARAMS
| Parameter | Type | Description |
|---|---|---|
| number | string | The tag number |
Success
Response
Status Code
200 Success
| Parameter | Type | Description |
|---|---|---|
| userId | string | User ID |
Example
{
"userId": "abc123"
}
Fail
Response
Status Code
404 User not found
500 Failed to get user id
Check if number exists
Check if the randomly generated tag number exists
URL
GET api/checkIfNumberExists
REQUEST PARAMS
| Parameter | Type | Description |
|---|---|---|
| number | string | The tag number |
Success
Response
Status Code
200 Success
| Parameter | Type | Description |
|---|---|---|
| exists | boolean | Status whether the tag number exists or not |
Example
{
"exists": true
}
Fail
Response
Status Code
500 Failed to check
Save User Data
Save User Data
URL
POST api/saveUserData
REQUEST BODY
| Parameter | Type | Description |
|---|---|---|
| userId | string | User ID |
Success
Response
Status Code
200 Save user data successfully
Fail
Response
Status Code
500 Failed to save user data
Save User Tag Number
Save User Tag Number
URL
POST api/saveUserTagNumber
REQUEST BODY
| Parameter | Type | Description |
|---|---|---|
| tagNumber | string | The tag number |
| userId | string | User ID |
Success
Response
Status Code
200 Save Tag number successfully
Fail
Response
Status Code
500 Failed to save Tag number