API Specification Document
Version Date Author Description
1.0 23-03-2024 Adarsh K Initial draft
Public
People feedbacks
● Endpoint: /api/public/feedbacks
● Method: GET
● Description: Get 5 feedbacks for displaying in main page.
● Response Body:
{ [ {“user_name” : “string” , “feedback” : “string},
{“user_name” : “string” , “feedback” : “string} ] }
Article hub
● Endpoint: /api/public/all_articles
● Method: GET
● Description: get all articles for the article hub
● Response Body:
{ [ {“article_id” : “string” ,“author” : “string” , “title” : “string” ,”content” :
“string” , “image” : “file” , “createdAt” : “string” },
{“article_id” : “string” ,“author” : “string” , “title” : “string” ,”content” :
“string” , “image” : “file” , “createdAt” : “string” } ] }
Find plans
● Endpoint: /api/public/plan_details
● Method: GET
● Description: get all plan for session
● Response Body:
{ [ {“plan_id” : “string” ,“plan_name” : “string” , “no_of_sessions” :
“string” ,”chat_access” : “string” , “price” : “string” },
{“plan_id” : “string” ,“plan_name” : “string” , “no_of_sessions” :
“string” ,”chat_access” : “string” , “price” : “string” }, ] }
All counselors
● Endpoint: /api/public/all_counselors
● Method: GET
● Description: get all counselor details
● Response Body:
{ [ {“counsellor_id” : “string” ,“name” : “string” , “qualification” :
“string” ,”specialization” : “string” , “next_avilability” : “string” , “languages” :
“string” },
{“counsellor_id” : “string” ,“name” : “string” , “qualification” :
“string” ,”specialization” : “string” , “next_avilability” : “string” , “languages” :
“string” },] }
Users
Create User
● Endpoint: /api/user/signup
● Method: POST
● Description: Create a new user.
● Request Body:
{ "username": "john smith", "email": "[email protected]",
“phone” : “9999999999” , "password": "password123" }
● Response Body:
{ "accessToken": “string”}
Login User
● Endpoint: /api/user/login
● Method: Post
● Description: Login into Homepage
● Request Body: {“email” : “[email protected]”, “password” : “pass123” }
● Response Body : {"accessToken": "string"}
Logout User
● Endpoint: /api/user/logout
● Method: Post
● Description: Logout the currently logged-in user
● Response Body : {“message” : “user successfully logout”}
Dashboard
Get user dashboard
● Endpoint: /api/user/dashboard
● Method: Get
● Description: Get details in dashboard.
● Response Body: { "active_plan_id": “string” , "plan_name": “string”,
"number_of_sesion": "string" , “counselor_id” : “string” , “counselor_name” :
“string” , “session_id “ : “string” , “session_date_time” : “string”}
User Profile
Get User Profile
● Endpoint: /api/user/profile
● Method: GET
● Description: Get comments for a specific post.
● Response Body: { "user_name": “string” , "email": “string”, "phone": "string" ,
“dob” : “string” }
Update User Profile
● Endpoint: /api/user/profile/update
● Method: PUT
● Description: Update profile details
● Request Body:
{ "name": “string”, "phone": "string" , “dob” : “string” }
● Response Body:
{ "message": “string” }
Update User password
● Endpoint: /api/user/profile/updatepassword
● Method: PUT
● Description: Update password
● Request Body:
{ "old_password": “string”, “new_password”:”string”}
● Response Body:
{ "message": “string” }
Personal Preference
Add personal preference
● Endpoint: /api/user/preference
● Method: POST
● Description: add user personal preference
● Request Body: { "help_for": “string”, "language": “string”,"gender": "string"}
● Response Body: {"message":”string”}
Plan purchasing
purchase the plan
● Endpoint: /api/user/plan/buy
● Method: POST
● Description: purchase plan for sessions
● Request Body: { "plan_id": “string”, "promocode": “string”,"amount": "string"}
● Response Body: {"message":”string”}
Book Session Appointment
get all available slots
● Endpoint: /api/user/sessions/available
● Method: GET
● Description: get all available slots
● Response Body: {"avilability_id":”string” , “date” : “string” ,”time”:”string”
“counselor_id”: “string” , “counselor_name” : “string” }
Select time slots and book
● Endpoint: /api/user/session/book
● Method: POST
● Description: select time slot and book the session
● Request Body: { "avilability_id": “string”, }
● Response Body: {"message":”string” , “session_id” : “string” , “counselor_id”:
“string” , “counselor_name” : “string” ,”schedule_date_time” : “string” }
cancel the session booking
● Endpoint: /api/user/session/cancel
● Method: DELETE
● Description: cancel the session booking
● Request Body: { "session_id": “string”, }
● Response Body: {"message":”string” }
Chat
Get Meetings
● Endpoint: /api/user/chat/messages
● Method: GET
● Description: Get a list of chat messages.
Send Message
● Endpoint: /api/user/chat/send
● Method: POST
● Description: Send a new chat message.
● Request Body: { "senderID": 1, "receiverID": 2,"message": "Hello there!"}
● Response Body: {"messageID": 1,"senderID": 1,"receiverID": 2,
"message":"Hello there!"}
Session Video Call
Start Call
● Endpoint: / api/user/session/calls/start
● Method: POST
● Description:Start a new video call.
● Request Body: { "callerID": 1,"calleeID": 2 }
● Response Body: { "callID": 1, "callerID": 1, "calleeID": 2, "status": "ongoing" }
feedback of session
● Endpoint: / api/user/session/calls/feedback
● Method: POST
● Description: add feedback
● Request Body: { "session_id": “string” , "feedback": “string” , }
● Response Body: { "message" : “string” }
Admin Side
Admin Login
● Endpoint: /api/admin/login
● Method: POST
● Description: Authenticate an admin user and obtain an access token.
● Request Body: { "username": "string", "password": "string" }
● Response: {"accessToken": "string"}
Logout Admin
● Endpoint: /api/admin/logout
● Method: Post
● Description: Logged out admin
● Response Body : {“message” : “Admin successfully logout”}
Get dashboard data
● Endpoint: /api/admin/dashboard
● Method: GET
● Description: Get details of dashboard.
● Response Body: { "success": true,
"active_subscribers": 100,
"number_of_clients": 500,
“number_of_counselors” : 299,
“todays_income” : “string”
"graph_data": {
"subscribers_per_day": [
{"date": "2024-03-01", "count": 10},
{"date": "2024-03-02", "count": 15},
{"date": "2024-03-03", "count": 20},
{"date": "2024-03-04", "count": 12}
],
"revenue_per_day": [
{"date": "2024-03-01", "count": 30},
{"date": "2024-03-02", "count": 25},
{"date": "2024-03-03", "count": 35},
{"date": "2024-03-04", "count": 20}
]
}
}
User Management
Get All Users
● Endpoint: /api/admin/userslist
● Method: GET
● Description: Get a list of Users.
● Response Body: [{"userID": 1,"username": "johnsmith","email":
"
[email protected]","status": "active" }, {"userID": 2,"username":
"janesmith","email":"
[email protected]","status": "blocked" }]
Get All counselors
● Endpoint: /api/admin/counselorslist
● Method: GET
● Description: Get a list of counselors.
● Response Body: [{"userID": 1,"username": "johnsmith","email":
"
[email protected]","status": "active" }, {"userID": 2,"username":
"janesmith","email":"
[email protected]","status": "blocked" }]
Block User
● Endpoint: /api/admin/users/{userID}/block
● Method: PUT
● Description: Block a user account.
● Response: {"userID": 2,"status": "blocked"}
UnBlock User
● Endpoint: /api/admin/users/{userID}/unblock
● Method: PUT
● Description: Unblock a previously blocked user account.
● Response: {"userID": 2,"status": "active"}
Counselor New Requests
Get All new requests
● Endpoint: /api/admin/allrequests
● Method: GET
● Description: Get a list of posts.
● Response Body: [{"request_id": 1,"name": "johnsmith","email":
"
[email protected]",”qualification” : “string” , "timestamp": "2023-11-
04T12:34:56" }, {"PostID": 2,"username":
"janesmith","email":"
[email protected]","timestamp": "2023-11-04T12:34:56" }]
Approve a request
● Endpoint: /api/admin/requests/{userID}/approve
● Method: PUT
● Description: approve a counselor request
● Response: {"userID": 2,"status": "approved"}
Reject a request
● Endpoint: /api/admin/request/{userID}/reject
● Method: PUT
● Description: Reject a counselor request
● Response: {"userID": 2,"status": "rejected"}
Session management
Get All Session Booking
● Endpoint: /api/admin/allbookings
● Method: GET
● Description: Get a list of session bookings.
● Response Body: [{"patient_id": 1,"counselor_id": "string","phone":
"string","time": "2023-11-04T12:34:56" , “session_id” : “string” , “status” :
“string” }, {"patient_id": 1,"counselor_id": "string","phone": "string","time": "2023-
11-04T12:34:56" , “session_id” : “string” , “status” : “string” }]
Get All Session feedbacks
● Endpoint: /api/admin/session/feedbacks
● Method: GET
● Description: Get a list of session feedbacks.
● Response Body: [{"patient_id": 1,"counselor_id": "string","patient_name":
"string","counselor_name": "string" , “session_id” : “string” , “rating” : “string”
},{"patient_id": 1,"counselor_id": "string","patient_name":
"string","counselor_name": "string" , “session_id” : “string” , “rating” : “string”
}]
Transaction Details
Get All subscription Purchases transactions
● Endpoint: /api/admin/allbookings
● Method: GET
● Description: Get a list of purchase transactions.
● Response Body: [{"patient_id": 1,"username": "string","time": "2023-11-
04T12:34:56" , “plan_name” : “string” , “amount” : “string” }, {"patient_id":
1,"counselor_id": "string","username": "string","time": "2023-11-04T12:34:56" ,
“plan_name” : “string” , “amount” : “string” }]
Get All counselor payment transactions
● Endpoint: /api/admin/session/feedbacks
● Method: GET
● Description: Get a list of counselor payments.
● Response Body: [{,"counselor_id": "string","username": "string","time": "2023-
11-04T12:34:56" , “transaction_id” : “string” , “amount” : “string” },
{"patient_id": 1,"counselor_id": "string","username": "string","time": "2023-11-
04T12:34:56" , “transaction_id” : “string” , “amount” : “string” }]
Article Management
Article hub
● Endpoint: /api/public/all_articles
● Method: GET
● Description: get all articles for the article hub
● Response Body:
{ [ {“article_id” : “string” ,“author” : “string” , “title” : “string” ,”content” :
“string” , “image” : “file” , “createdAt” : “string” },
{“article_id” : “string” ,“author” : “string” , “title” : “string” ,”content” :
“string” , “image” : “file” , “createdAt” : “string” } ] }
Remove an article
● Endpoint: /api/admin/article/{article_id}/remove
● Method: DELETE
● Description: Remove an article from article hub
● Response: {"article_id": 2,"status": "removed"}
Promocode Management
Get All Promocode
● Endpoint: /api/admin/promocodes
● Method: GET
● Description: Get a list of promocodes.
● Response Body: [{"code_id": 1,"promocode": "string","start_date":
"string","end_date": "string" ,”discount” : “string” , “status” : “string” },
{"code_id": 1,"promocode": "string","start_date": "string","end_date":
"string" ,”discount” : “string” , “status” : “string” }, ]
Add new promocode
● Endpoint: /api/admin/promocode/ add
● Method: POST
● Description: add new promocode
● Request Body: { "promocode": 1, "discount": "string" , “start_date” : “string” ,
“end_date” : “string”}
● Response Body: { "code_id": 1,"promocode": "string","start_date":
"string","end_date": "string" ,”discount” : “string” , “status” : “string”"}
kill a promocode
● Endpoint: /api/admin/promocode/{promocode_id}/kill
● Method: PUT
● Description: make the promocode expired and no more avilable
● Response: {"message": 2,"status": "killed"}
Subscription Plan Management
Get All plans
● Endpoint: /api/admin/allPlans
● Method: GET
● Description: Get a list of available plans.
● Response Body: [ { "id": 1, "plan_name":” string”,"no_of_session": "string",
"chat_access": "string", "price": "string", },{ "id": 1, "plan_name":”
string”,"no_of_session": "string", "chat_access": "string", "price": "string", },]
Edit plan details
● Endpoint: /api/admin/plan/edit
● Method: PUT
● Description: Edit the current plan details
● Request Body: { "id": 1, "plan_name":” string”,"no_of_session": "string",
"chat_access": "string", "price": "string", }
● Response Body: { "id": 1, "plan_name":” string”,"no_of_session": "string",
"chat_access": "string", "price": "string", }
Remove a plan
● Endpoint: /api/admin/plan/{plan_id}/remove
● Method: PUT
● Description: make the plan unavilable
● Response: {"message": 2,"status": "removed"}
Add new Plan
● Endpoint: /api/admin/plan/ addnew
● Method: POST
● Description: add new plan
● Request Body: { "plan_name":” string”,"no_of_session": "string", "chat_access":
"string", "price": "string", }
● Response Body: { "plan_name":” string”,"no_of_session": "string",
"chat_access": "string", "price": "string", }
Counselors
Create User
● Endpoint: /api/user/signup
● Method: POST
● Description: Create a new user.
● Request Body:
{ "username": "john smith", "email": "[email protected]",
“phone” : “9999999999” , "password": "password123" }
● Response Body:
{ "accessToken": “string”}
Login User
● Endpoint: /api/user/login
● Method: Post
● Description: Login into Homepage
● Request Body: {“email” : “[email protected]”, “password” : “pass123” }
● Response Body : {"accessToken": "string"}
Logout User
● Endpoint: /api/user/logout
● Method: Post
● Description: Logout the currently logged-in user
● Response Body : {“message” : “user successfully logout”}
Dashboard
Get counselor dashboard
● Endpoint: /api/counselor/dashboard
● Method: Get
● Description: Get details in dashboard.
● Response Body: { "todays_sessions": “string” , "total_session": “string”,
"total_income": "string" , “last_week_income” : “string” , “upcoming_session_id” :
“string” , “patient_name “ : “string” , “session_date_time” : “string”}
Counselor Profile
Get Counselor Profile
● Endpoint: /api/counselor/profile
● Method: GET
● Description: Get counselor profile.
● Response Body: { "user_name": “string” , "email": “string”, "phone": "string" ,
“dob” : “string” }
Update counselor Profile
● Endpoint: /api/counselor/profile/update
● Method: PUT
● Description: Update profile details
● Request Body:
{ "name": “string”, "phone": "string" , “dob” : “string” }
● Response Body:
{ "message": “string” }
Update Counselor password
● Endpoint: /api/counselor/profile/updatepassword
● Method: PUT
● Description: Update password
● Request Body:
{ "old_password": “string”, “new_password”:”string”}
● Response Body:
{ "message": “string” }
Counselor sessions list
Get Counselor session list
● Endpoint: /api/counselor/sessions/list
● Method: GET
● Description: Get counselor session list.
● Response Body: { "patient_name": “string” , "counseling_for": “string”, "phone":
"string" , “time_date” : “string” , “status” : “string” }
Chat
Get Meetings
● Endpoint: /api/counselor/chat/messages
● Method: GET
● Description: Get a list of chat messages.
Send Message
● Endpoint: /api/counselor/chat/send
● Method: POST
● Description: Send a new chat message.
● Request Body: { "senderID": 1, "receiverID": 2,"message": "Hello there!"}
● Response Body: {"messageID": 1,"senderID": 1,"receiverID": 2,
"message":"Hello there!"}
Session Video Call
Start Call
● Endpoint: / api/counselor/session/calls/start
● Method: POST
● Description:Start a new video call.
● Request Body: { "callerID": 1,"calleeID": 2 }
● Response Body: { "callID": 1, "callerID": 1, "calleeID": 2, "status": "ongoing" }
notes of session
● Endpoint: / api/counselor/session/calls/notes
● Method: POST
● Description: adding notes about patients condition in session.
● Request Body: { "session_id": “string” , "notes": “string” , }
● Response Body: { "message" : “string” }
Manage Session slots
enable time slots of availability
● Endpoint: /api/counselor/slots/available
● Method: POST
● Description: select time slot and make visible to patients
● Request Body: { "available_date": “string”, “avilable_times” : “string” }
● Response Body: {”message” : “string” }
cancel the session booking
● Endpoint: /api/counselor/session/cancel
● Method: DELETE
● Description: cancel the session booking
● Request Body: { "session_id": “string”, }
● Response Body: {"message":”string” }
Article Management
My articles
● Endpoint: /api/counselor/my_articles
● Method: GET
● Description: get all articles written by the counselor
● Response Body:
{ [ {“article_id” : “string” ,“author” : “string” , “title” : “string” ,”content” :
“string” , “image” : “file” , “createdAt” : “string” },
{“article_id” : “string” ,“author” : “string” , “title” : “string” ,”content” :
“string” , “image” : “file” , “createdAt” : “string” } ] }
Remove an article
● Endpoint: /api/counselor/article/{article_id}/remove
● Method: DELETE
● Description: Remove an article from article hub
● Response: {"article_id": 2,"status": "removed"}
edit an article
● Endpoint: /api/counselor/article/{article_id}/edit
● Method: PUT
● Description: update an article
● Request Body: { "article_id” : “string” , “title” : “string” ,”content” : “string” ,
“image” : “file” , }
● Response: {"message": "string"}
feedback Management
Get my Session feedbacks
● Endpoint: /api/counselor/session/feedbacks
● Method: GET
● Description: Get a list of session feedbacks.
● Response Body: [{"patient_id": 1,"patient_name": "string",“session_id” :
“string” , “rating” : “string” },{"patient_id": 1,"patient_name":
"string",“session_id” : “string” , “rating” : “string” }]
Payment Tab
Get my Session payment details
● Endpoint: /api/counselor/payments
● Method: GET
● Description: Get a list of session payments.
● Response Body: [{,"counselor_id": "string","username": "string","time": "2023-
11-04T12:34:56" , “transaction_id” : “string” , “amount” : “string” },
{,"counselor_id": "string","username": "string","time": "2023-11-04T12:34:56" ,
“transaction_id” : “string” , “amount” : “string” }]
Get my current week income details
● Endpoint: /api/counselor/income/curr_week
● Method: GET
● Description: Get a list of session inoome in this week.
● Response Body: {,"total_session": "string","amount_per_session":
"string","total_earning": "string"}
verification documents
upload document for verification
● Endpoint: /api/counselor/document/verification
● Method: POST
● Description: upload datas and documents required for profile verification
● Request Body: { "qualification": “string”, “dob” : “string” ,“gender” : “string” ,
“language” : “string”, “experience” : “string” , “specialization” : “string” ,
“qualification_document” : “file” , “experience_document” : “file”, “profile_photo” :
“file” }
● Response Body: {”message” : “string” }