Skip to content

Instantly share code, notes, and snippets.

@el0911
Created October 9, 2019 16:43
Show Gist options
  • Save el0911/9a20dcc110dc323619155dd74cf32f1c to your computer and use it in GitHub Desktop.
Save el0911/9a20dcc110dc323619155dd74cf32f1c to your computer and use it in GitHub Desktop.

BALANCEBOWL API Documentation Templates

By Somto Achu

The BalanceBowl project contract assigned to NESA by Makers

#APIS

Where full URLs are provided in responses they will be rendered as if service is running on 'http://testserver/'.

Open Endpoints

Open endpoints require no Authentication.

  • Login : POST /api/login/
  • SignUp : POST /api/Register/
  • Forgotpassword : POST /api/forgotpassword/
  • requestVerification : POST /api/requestVerification/
  • confirmVerification : POST /api/confirmVerification/
  • completeReg : POST /api/completeReg/

Closed Endpoints

Closed endpoints require no Authentication.

  • userstate : get /api/userstate/

Login

Used to collect a Token for a registered User.

URL : /api/login/

Method : POST

Auth required : NO

Data constraints

{
    "email": "[valid email address]",
    "password": "[password in plain text]"
}

Data example

{
    "email": "iloveauth@example.com",
    "password": "abcd1234"
}

Success Response

Code : 200 OK

Content example

{
    "status":true,
    "data":{
    "token": "93144b288eb1fdccbe46d6fc0f241a51766ecd3d",
    "user":"full name"
    }
}

Error Response

Code : 400 BAD REQUEST

Content :

     {
       "status": false,
       "error": "error message"
      }

Register

Used to Register a new user

URL : /api/register/

Method : POST

Auth required : NO

Data constraints

{
    "username": "[username]",
    "email": "[valid email address]",
    "password": "[password in plain text]"
}

Data example

{
    "email": "iloveauth@example.com",
    "username": "somt123",
    "password": "abcd1234"
}

Success Response

Code : 200 OK

Content example

{
    "status":true,
}

Error Response

Code : 400 BAD REQUEST

Content :

{
       "status": false,
       "error": "error message"
      }

Forgotpassword

used to help a user request for a new password, it collects the mail and send an email to the user containing change password link token

URL : /api/Forgotpassword /

Method : POST

Auth required : NO

Data constraints

{
    
    "email": "[valid email address]"
    
}

Data example

{
    "email": "iloveauth@example.com",
}

Success Response

Code : 200 OK

Content example

{}

Error Response

Code : 400 BAD REQUEST

Content :

{
       "status": false,
}

RequestVerification

used to request a verification token sent to mobile phone

URL : /api/requestVerification/

Method : POST

Auth required : NO

Data constraints

{
    
    "phoneNumber": "[validphone number]"
    
}

Data example

{
    "phoneNumber": "090909099090",
}

Success Response

Code : 200 OK

Content example

{}

Error Response

Code : 400 BAD REQUEST

Content :

{
       "status": false,
}

ConfirmVerification

Confirms the verification token sent to the user via text confimsd the user as verified URL : /api/confirmVerification/

Method : POST

Auth required : NO

Data constraints

{   "code":"[4 digit code]",
    "phoneNumber": "[validphone number]"   
}

Data example

{   "code":"0990",
    "phoneNumber": "090909099090",
}

Success Response

Code : 200 OK

Content example

{
      "status":true,
    "data":{
    "token": "93144b288eb1fdccbe46d6fc0f241a51766ecd3d",
    "user":"full name"
    }
}

Error Response

Code : 400 BAD REQUEST

Content :

{
       "status": false,
       "nessage":"error message"
}

CompleteReg

Request contains remaining user profile details

URL : /api/completeReg/

Method : POST

Auth required : NO

Data constraints

{    
    "phoneNumber": "[validphone number]",
    "gender":"[boolean]",
    "years":"[user year]",
    "UserID":"[userID]",
    "code":"[placeholder this could be empty]"
}

Data example

{   "code":"0990",
    "phoneNumber": "090909099090",
}

Success Response

Code : 200 OK

Content example

{
      "status":true,
    "data":{
    "token": "93144b288eb1fdccbe46d6fc0f241a51766ecd3d",
    "user":"full name"
    }
}

Error Response

Code : 400 BAD REQUEST

Content :

{
       "status": false,
       "nessage":"error message"
}

Closed routes

userstate

Request contains remaining user profile details

URL : /api/userstate/

Method : GET

Auth required : YES

Data constraints

{    
    ** None 
}

Data example

{  
    ** None
}

Success Response

Code : 200 OK

Content example

{
    "premium": true,
}

Error Response

Code : 400 BAD REQUEST

Content :

{
       "status": false,
       "nessage":"error message"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment