Skip to content

Instantly share code, notes, and snippets.

@el0911
Created October 9, 2019 16:46
Show Gist options
  • Save el0911/2a4bfaa9cde47a5311bf1cf5bdee93c1 to your computer and use it in GitHub Desktop.
Save el0911/2a4bfaa9cde47a5311bf1cf5bdee93c1 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 Plans

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 plans and meals.

  • load : GET /api/plans/load
  • planmeals : GET /api/plan/meals
  • allmeals : GET /api/plans/allmeals
  • loadmeal : GET /api/meal/

Load

Load all the meal plans available, if the user is premium it loads all the meal plans if user isnt premium then return only clasic plan and an object containing a parameter saying premium:false

URL : /api/plans/load

Method : GET

Auth required : YES

Data constraints

None

Data example

None

Success Response

Code : 200 OK

Content example

[
    {
        planName:planname,
        text:text,
        planid:planid
    },
      {
        planName:planname,
        text:text,
        planid:planid
    },
      {
        planName:planname,
        text:text,
        planid:planid
    }

    //if user isnt on premium then return 

      {
        planName:classicplan,
        text:text,
        planid:planid
    },
      {
       premium:false
    }
    ///////////////////////////////////
]

Error Response

Code : 400 BAD REQUEST

Content :

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

PlanMeals

Get the list list of meals arranged into their groupID check UI for clarifications the todays meal section

URL : /api/plans/meals

Method : GET

Auth required : YES

Data constraints

{
    planID:[plan id ]
}

Data example

{
    planID:string
}

Success Response

Code : 200 OK

Content example

[
     {
         title:string,
         id:string,
         meals:[
             {
             liked:boolean,
             time:Breakfast||Lunch||Dinner,
             detail:string,
             imageresource:string,
             groupID:string,
             id:string
             },
              {
             liked:boolean,
             time:Breakfast||Lunch||Dinner,
             detail:string,
             imageresource:string,
              groupID:string,
             id:string
             },
              {
             liked:boolean,
             time:Breakfast||Lunch||Dinner,
             detail:string,
             imageresource:string,
              groupID:string,
             id:string
             }
         ]
     },

      {
         title:string,
         id:string,
         meals:[
             {
             liked:boolean,
             time:Breakfast||Lunch||Dinner,
             detail:string,
             imageresource:string,
              groupID:string,
             id:string
             },
              {
             liked:boolean,
             time:Breakfast||Lunch||Dinner,
             detail:string,
             imageresource:string,
             groupID:string,
             id:string
             },
              {
             liked:boolean,
             time:Breakfast||Lunch||Dinner,
             detail:string,
             imageresource:string,
              groupID:string,
             id:string
             }
         ]
     }
]

Error Response

Code : 400 BAD REQUEST

Content :

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

All meals

Load the list of the meals from one group Note search items by groupID

URL : /api/plans/load

Method : GET

Auth required : YES

Data constraints

{
    groupID:[group id]
}

Data example

{
    groupID:string
}

Success Response

Code : 200 OK

Content example

[
             {
                liked:boolean,
                time:Breakfast||Lunch||Dinner,
                detail:string,
                imageresource:string,
                groupID:string,
                id:string
             },
              {
                liked:boolean,
                time:Breakfast||Lunch||Dinner,
                detail:string,
                imageresource:string,
                groupID:string,
                id:string
             },
              {
                liked:boolean,
                time:Breakfast||Lunch||Dinner,
                detail:string,
                imageresource:string,
                groupID:string,
                id:string
             }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment