Routes : Message
File Name : message.js
File Path : server/routes/api/message.js
Contains route which create, update, view and delete the message. These functionalities are included in message Controller.
Post Message Route
1.API Path:
api/messages/
2.Method:
POST
3.Description:
Message route is used to create a new messages.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Name | Type | Required |
---|---|---|
message | String | true |
sentBy | String | true |
senderRead | Boolean | true |
receiverRead | Boolean | true |
sender | ObjectId | true |
receiver | ObjectId | true |
senderRole | String | true |
receiverRole | String | true |
timestamp | Number | true |
Response:
Returns an object with properties: Data.
Http Code:200
Data:{ }
Type: Object
Name | Type |
---|---|
statusCode | Number |
Data | Object |
Description:Data is an Object with a message.
Get Message Route
1.API Path:
api/messages/counts/
2.Method:
GET
3.Description:
Message route is used to get number of unread messages for seller.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:{ }
Type: Object
Name | Type |
---|---|
statusCode | Number |
Data | Object |
Description:Data is an Object with a message.
Get Message Route
1.API Path:
api/messages/mark/read/
2.Method:
GET
3.Description:
Message route is used to mark unread messages as read.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all read messages.
Get Message Route
1.API Path:
api/messages/owner/manager/:id/:pageno
2.Method:
GET
3.Description:
Message route is used to get a thread of messages between owner to manager.
4.Parameters:
FieldName: req,
Type: Object,
id: req.params.id(senderId),
pageno: req.params.pageno,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all thread of messages.
Get Message Route
1.API Path:
api/messages/update/byseller/:id
2.Method:
GET
3.Description:
Message route is used to get all messages sent by seller.
4.Parameters:
FieldName: req,
Type: Object,
id: req.params.id(senderId),
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all messages sent by seller.
Get Message Route
1.API Path:
api/messages/managers/list
2.Method:
GET
3.Description:
Message route is used to get all chat messages that owner chatted with managers.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all messages that owner chatted with managers.
Get Message Route
1.API Path:
api/messages/owners/list
2.Method:
GET
3.Description:
Message route is used to get all owner's chat messages.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all messages that owner's had.
Get Message Route
1.API Path:
api/messages/admins/list
2.Method:
GET
3.Description:
Message route is used to get all owner's chat messages with admin.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all messages that owner's had with admin.
Get Message Route
1.API Path:
api/messages/unread/list
2.Method:
GET
3.Description:
Message route is used to get all unread messages.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all unread messages.
Get Message Route
1.API Path:
api/messages/single/thread/read/:id
2.Method:
GET
3.Description:
Message route is used to get all unread messages of single senderId.
4.Parameters:
FieldName: req,
Type: Object,
id: req.params.id(senderId)
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data:[ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is an Array with all unread messages of particular sender.
Get Message Route
1.API Path:
api/messages/total/unread/count
2.Method:
GET
3.Description:
Message route is used to count all unread messages.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data: Number
Type: Number
Name | Type |
---|---|
statusCode | Number |
Data | Number |
Description:Data is number of unread messages.
Get Message Route
1.API Path:
api/messages/managers/list/by/user
2.Method:
GET
3.Description:
Message route is used to get all managers data who ever met with owner.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data: [ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is Array with managers basic information who ever met with owner.
Get Message Route
1.API Path:
api/messages/users/list/by/manager
2.Method:
GET
3.Description:
Message route is used to get all user data who ever met with managers.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data: [ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is Array with users basic information who ever met with manager.
Get Message Route
1.API Path:
api/messages/owner/list/by/admin
2.Method:
GET
3.Description:
Message route is used to get all managers data who ever met through admin.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data: [ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is Array with managers basic information who ever met through admin.
Get Message Route
1.API Path:
api/messages/owner/search/by/admin/:key
2.Method:
GET
3.Description:
Message route is used to get all managers data with particular key who ever met through admin.
4.Parameters:
FieldName: req,
Type: Object,
jwtAccessToken: TRUE,
In: Header,
Type: String,
Description: JWT access token is used to check the authenticity of the message.
Response:
Returns an object with properties: Data.
Http Code:200
Data: [ ]
Type: Array
Name | Type |
---|---|
statusCode | Number |
Data | Array |
Description:Data is Array with managers basic information who ever met through admin with particular key.