“Invalid request: user ID is required in the request body.”
If another error occurs (ex. passing the wrong data type in the body).
“There was an error with the request.”
/validateSession
Description
Validate a session and update its expiration time if it’s valid.
HTTP Verb
POST
Success Codes
200
Failure Codes
400, 500
Request Schema
Request expects no body. Request expects a cookie named sessionCookie which is generated when /createSession is called. The cookie should be formatted like so:
Request expects no body. A valid cookie (shown above) must be sent. This cookie is automatically generated when you call /createSession.
Response Schema
{
email: string,
userId: string,
role: string
}
Sample Success Response
{
“message”: “Session is not expired”,
“data”: {
“email”: “sample@email.com”,
“userId”: “63ded2f901770f255dff8d04”,
“role”: “Admin”
}
}
Fail Response
{
"message": <MESSAGE GIVEN CONDITION>
}
Condition
Message
If no cookie is sent.
“Invalid request: session cookie is required.”
If session cookie is expired.
“Invalid request: session cookie is expired. Please create a new session.”
Some other error occurs (ex. unexpected database error).
“There was an error validating the session.”
/deleteSession
Description
Delete a session and set the user’s cookie to be expired.
HTTP Verb
POST
Success Codes
200
Failure Codes
400, 500
Request Schema
Request expects no body. Request expects a cookie named sessionCookie which is generated when /createSession is called. The cookie should be formatted like so: