Skip to content

uwm-its-csi/shopping-list-api

Repository files navigation

shopping-list-api

Base URL: https://rbeerma-shoppinglist.azurewebsites.net

Getting all shopping lists

GET /api/shoppinglists (returns all shopping lists in the database)
Parameters

None

Responses
http code content-type response
200 application/json <userID>, <list<item>>
Example Call

https://rbeerma-shoppinglist.azurewebsites.net/api/shoppinglists

Example Response
[
   {
       "userID": "cooper",
       "list": [
           {
               "id": 1,
               "name": "dog biscuits",
               "quantity": 42,
               "checked": false
           },
           {
               "id": 2,
               "name": "dog food",
               "quantity": 1,
               "checked": true
           },
           {
               "id": 3,
               "name": "Fresh Pet",
               "quantity": 1000,
               "checked": false
           },
           {
               "id": 4,
               "name": "Toys!",
               "quantity": 5,
               "checked": false
           }
       ]
   },
   {
       "userID": "rbeerma",
       "list": [
           {
               "id": 1,
               "name": "Milk",
               "quantity": 1,
               "checked": true
           },
           {
               "id": 2,
               "name": "coffee",
               "quantity": 5,
               "checked": false
           },
           {
               "id": 3,
               "name": "Donuts",
               "quantity": "13",
               "checked": true
           }
       ]
   }
]

Getting a shopping list by user ID

GET /api/shoppinglists (returns one shopping list, by user ID)
Parameters

userID

Responses
http code content-type response
200 application/json <list>
Example Call

https://rbeerma-shoppinglist.azurewebsites.net/api/shoppinglists?userID=cooper

Example Response
[
   {
       "id": 1,
       "name": "dog biscuits",
       "quantity": 42,
       "checked": false
   },
   {
       "id": 2,
       "name": "dog food",
       "quantity": 1,
       "checked": true
   },
   {
       "id": 3,
       "name": "Fresh Pet",
       "quantity": 1000,
       "checked": false
   },
   {
       "id": 4,
       "name": "Toys!",
       "quantity": 5,
       "checked": false
   }
]

Saving a shopping list

POST /api/shoppinglists (saves a shopping list to the database)
Parameters

None

Request Body
userID: string
list: array of type 'item'
item:
  id: int
  name: string
  quantity: int
  checked: boolean
Example Request Body
{
    "userID": "cooper",
    "list": [
        {
            "id": 1,
            "name": "dog biscuits",
            "quantity": 42,
            "checked": false
        },
        {
            "id": 2,
            "name": "dog food",
            "quantity": 1,
            "checked": true
        },
        {
            "id": 3,
            "name": "Fresh Pet",
            "quantity": 1000,
            "checked": false
        },
        {
            "id": 4,
            "name": "Toys!",
            "quantity": 5,
            "checked": false
        }
    ]
}
Responses (currently, a success response is just the MongoDB acknowledgement)
http code content-type response
200 application/json <acknowledgement>
Example Response
{
   "acknowledged": true,
   "modifiedCount": 0,
   "upsertedId": null,
   "upsertedCount": 0,
   "matchedCount": 1
}

Getting a list of available items

GET /api/itemlist (returns a list of available items)
Parameters

None

Responses
http code content-type response
200 application/json <item list>
Example Call

https://rbeerma-shoppinglist.azurewebsites.net/api/itemlist

Example Response
[
    {
        "name": "Milk"
    },
    {
        "name": "Bread"
    },
    ...
]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published