Index:
- Invalid User Input
- Email To Verify Not Found
- Invalid Verification Code
- User Already Verified
- Database Connection Failed
- Cannot Auth To alphapoint
- Cannot Change Verification Level
- Wrong Accept Header
- Method Not Allowed
- Not Found
It creates a new verification message.
headers:
Accept: application/json
body:
{
"phone": 015555555555
"email": "example@domain.com"
}
Headers:
Content-Type: application/json
Status: 201 Created
Body:
{
"server": {
"status": 201,
"message": "Created"
},
"client": {
"status": 10,
"status": "Message Sent"
},
"data": {
"_id": "507f1f77bcf86cd799439011"
"created_at": "2016-05-18T16:00:00Z"
"verified": false,
"phone": "015555555555",
"email": "example@domain.com"
}
}
It verifies a user.
Headers:
Accept: application/json
Body:
{
"email": "example@domain.com",
"code": "abcdef" // len(6)
}
Headers:
Content-Type: application/json
Status: 202 Accepted
Body:
{
"server": {
"status": 202,
"message": "Accepted"
},
"client": {
"status": 11,
"message": "User Verified"
},
"data": {
"_id": "507f1f77bcf86cd799439011",
"created_at": "2016-05-18T16:00:00Z",
"updated_at": "2016-05-18T16:01:00Z",
"email": "starships@outlook.com",
"phone": "015555555555",
"code": "abcdef",
"verified": true,
}
}
If you try to submit invalid (blank or not corresponding to the model) data.
Headers:
Content-Type: application/json
Status: 400 Bad Request
Body:
{
"server": {
"status": 400,
"message": "Bad Request"
},
"client": {
"status": 20,
"message": "Invalid User Input"
}
}
If the user has not receive a verification mesage and is trying to "verify" his account.
Headers:
Content-Type: application/json
Status: 400 Bad Request
Body:
{
"server": {
"status": 400,
"message": "Bad Request"
},
"client": {
"status": 23,
"message": "User Not Found"
}
}
If the verification code is wrong.
Headers:
Content-Type: application/json
Status: 400 Bad Request
Body:
{
"server": {
"status": 400,
"message": "Bad Request"
},
"client": {
"status": 24,
"message": "Invalid Verification Code"
}
}
If you try to verify an already verified user.
Headers:
Content-Type: application/json
Status: 400 Bad Request
Body:
{
"server": {
"status": 400,
"message": "Bad Request"
},
"client": {
"status": 25,
"message": "User Already Verified"
}
}
If something went wrong during the db connection.
Headers:
Content-Type: application/json
Status: 500 Internal Server Error
Body:
{
"server": {
"status": 500,
"message": "Internal Server Error"
},
"client": {
"status": 31,
"message": "Database Connection Failed"
}
}
If the service could not auth with alphapoint.
Headers:
Content-Type: application/json
Status: 500 Internal Server Error
Body:
{
"server": {
"status": 500,
"message": "Internal Server Error"
},
"client": {
"status": 40,
"message": "Cannot Auth To Alphapoint"
}
}
If the service could not change the verification level of the user (alphapoint).
Headers:
Content-Type: application/json
Status: 500 Internal Server Error
Body:
{
"server": {
"status": 500,
"message": "Internal Server Error"
},
"client": {
"status": 41,
"message": "Cannot Change Verification Level"
}
}
If the Accept
header is different from application/json
.
Headers:
Accept: text/html
Headers:
Content-Type: application/json
Status: 406 Not Acceptable
Body:
{
"server": {
"status": 406,
"message": "Not Acceptable"
}
}
Only POST
method allowed.
Headers:
Content-Type: application/json
Status: 405 Method Not Allowed
Body:
{
"server": {
"status": 405,
"message": "Method Not Allowed"
}
}
Only /api/messages
and /api/verify/
routes allowed.
Headers:
Content-Type: application/json
Status: 404 Not Found
Body:
{
"server": {
"status": 404,
"message": "Not Found"
}
}