Skip to main content

API App

App utilities

Tip

Ensure you have completed the configuration steps Here


Used to get statistical data from the API


Request body

{
"query": "String"
}

Body Validation

  1. query - term to search for

Request

POST
http://localhost:5501/api/v1/app/search

Response

{
"status": "String",
"message": "String",
"results": "Number",
"searchResults": "Array"
}

Response Validation

  1. status - request status
  1. message - response mesage
  1. results - total query results
  1. searchResults - Array containing search data

Example

Body

{
"query":"ale"
}

Response

{
"status": "success",
"message": "search data",
"results": 2,
"searchResults": [
{
"data": "alex kk",
"field": "name",
"model": "userModel"
}
]
}

User aggregation

Request

GET
http://localhost:5501/api/v1/app/aggregation/user

Response

{
"status": "String",
"message": "String",
"verifiedUsers": "Array",
"activeUsers": "Array",
"deactivatedUsers": "Array",
"maleUsers": "Array",
"femaleUsers": "Array",
"months": "Array",
"googleUsers": "Array",
"recentUser": "Array",
"emailUsers": "Array",
"unVerifiedUsers": "Array",
}

Response Validation

Self explanatory


Example

Response

{
"status": "success",
"message": "aggregation data",
"verifiedUsers": [
{
"_id": "62d4e9bf167f537cf7db8c44",
"email": "system-email-vgy9hypjj5w83c_f9k4ix-1658120639392-mobile-auth",
"login": [],
"createdby": [
"techkey"
],
"registeredBy": "mobile"
},
],
"activeUsers": [
{
"_id": "62d4e6f6167f537cf7db8c37",
"email": "user3@vastly.com",
"login": []
}
],
"deactivatedUsers": [
{
"_id": "62d4e9bf167f537cf7db8c44",
"email": "system-email-vgy9hypjj5w83c_f9k4ix-1658120639392-mobile-auth",
"deactivationReason": "i am tired"
}
],
"maleUsers": [
{
"_id": "629ad74878103d4e4a74e9e6"
}
],
"femaleUsers": [],
"months": [
{
"month": 1, // Feb
"total": 0 // Total users that registered in Feb
}
],
"googleUsers": [],
"recentUser": [
{
"name": "alex kk",
"photo": "default.jpg",
"email": "user3@vastly.com",
"isVerified": false,
"createdby": "techkey",
"date": "2022-07-18T04:48:42.849Z"
}
],
"emailUsers": [
{
"_id": "62d4e9bf167f537cf7db8c44",
"email": "system-email-vgy9hypjj5w83c_f9k4ix-1658120639392-mobile-auth"
}
],
"unVerifiedUsers": [
{
"_id": "62d4e6f6167f537cf7db8c37",
"photo": "default.jpg",
"name": "alex kk",
"email": "user3@vastly.com",
"identifier": "email",
"phone": "",
"bio": "",
"isVerified": false,
"isActive": true,
"createdby": "techkey",
"date": "2022-07-18T04:48:42.849Z",
"__v": 0
}
]
}

SMS aggregation

Request

GET
http://localhost:5501/api/v1/app/aggregation/sms

Response

{
"status": "String",
"message": "String",
"sms": "Array"
}

Response Validation

  1. status - request status
  1. message - response message
  1. sms - List of all sent SMS

Example

Response

{
"status": "success",
"message": "Sms data",
"sms": [
{
"_id": "62d5124d167f537cf7db8cba",
"messageID": "73b91c883e6640ef9f774add430017f3",
"originator": "Techkey",
"body": "Your Techkey Verification code is 249193. Do not share this code with anyone.",
"createdDatetime": "2022-07-18T07:57:01+00:00",
"recipients": {
"totalCount": 1,
"totalSentCount": 1,
"totalDeliveredCount": 0,
"totalDeliveryFailedCount": 0,
"items": [
{
"recipient": 254710xxxxxxx,
"status": "sent",
"statusDatetime": "2022-07-18T07:57:01+00:00",
"messagePartCount": 1
}
]
},
"status": "success",
"statusMessage": "Message sent",
"date": "2022-07-18T04:48:43.916Z",
"__v": 0
}
]
}


Email aggregation

Request

GET
http://localhost:5501/api/v1/app/aggregation/email

Response

{
"status": "String",
"message": "String",
"emails": "Array"
}

Response Validation

  1. status - request status
  1. message - response message
  1. emails - List of emails sent

Example

Response

{
"status": "success",
"message": "Email data",
"emails": [
{
"_id": "62a7a25d2f5d96f9e8ed117d",
"to": "user@example.com",
"status": "success",
"subject": "Verify Your Account",
"data": "341491",
"date": "2022-06-13T20:47:10.928Z",
"__v": 0
},
{
"_id": "62aaeb6fef78b0b35f546127",
"to": "admin@example.com",
"status": "failed",
"subject": "An Error was detected",
"data": "There was an error that was handled by the controller.\n The message recorded was: Internal server Error. This occurred when \"A not logged in user\" tried accessing the Request path /id \n when sending a GET Request. Check API logs. ",
"date": "2022-06-16T08:35:10.843Z",
"__v": 0
},
]
}