Skip to content

API for storing and retrieving cooking recipes from Firebase Realtime Database and summarizing weekly groceries shopping list.

Notifications You must be signed in to change notification settings

jlolivaresp/cooking_recipes_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopping API documentation version 1

http://example.com/{version}

  • version: required(1)

Welcome to the Shopping API Documentation. This API allows you to interact with a DB to store recipes an their ingredients.

/units

URI for everything related to the Units class.

get
post
delete
×

get /units

HTTP status code 200

Body

Media type: application/json

Type:

{
  "type": "array",
  "items": {
    "type": "string"
  }
}

Example:

[
  "slices",
  "floz",
  "tons",
  "tbsp",
  "cubic_meters"
]

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
×

post /units

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
      "units": {"type": ["string", "array"]}
  }
}

Example:

{
  "units": "g"
}

HTTP status code 201

Body

Media type: application/json

Type:

{
  "units": [
      "g"
  ]
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}
×

delete /units

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
      "units": {"type": ["string", "array"]}
  }
}

Example:

{
  "units": "g"
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "units": [
      "g"
  ]
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

/supermarkets

URI for everything related to the Supermarket class.

get
post
delete
×

get /supermarkets

HTTP status code 200

Body

Media type: application/json

Type:

{
  "type": "array",
  "items": {
    "type": "string"
  }
}

Example:

[
  "edeka",
  "aldi"
]

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
×

post /supermarkets

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
      "supermarkets": {"type": ["string", "array"]}
  }
}

Example:

{
  "supermarkets": "aldi"
}

HTTP status code 201

Body

Media type: application/json

Type:

{
  "supermarkets": [
      "aldi"
  ]
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}
×

delete /supermarkets

Body

Media type: application/json

Type:

{
"type": "object",
  "properties": {
      "supermarkets": {"type": ["string", "array"]}
  }
}

Example:

{
  "supermarkets": "aldi"
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "supermarkets": [
      "aldi"
  ]
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

/ingredients

URI for everything related to the Ingredients class.

get
×

get /ingredients/all

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "name": {"type": "string"},
      "category": {"type": "string"},
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "name": "Onion",
    "category": "Vegetable/Fruit",
    "supermarkets": [
      "Aldi",
      "Edeka"
    ],
    "units": [
      "u",
      "g"
    ]
  },
  "-M9HqlUQnD7MS-DS53cKJ": {
    "name": "...",
    "category": "...",
    "supermarkets": [],
    "units": []
  },
  "-M9HqlUQnD7MS-LKH4c8": {},
  "-M9HqlUQnHJGF-5KJHF4": {}
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
get
post
put
delete
×

get /ingredients/single

Query Parameters

  • id: required(string)

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "name": {"type": "string"},
      "category": {"type": "string"},
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "name": "Onion",
    "category": "Vegetable/Fruit",
    "supermarkets": [
      "Aldi",
      "Edeka"
    ],
    "units": [
      "u",
      "g"
    ]
  }
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
×

post /ingredients/single

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
      "name": {"type": "string"},
      "units": {"type": ["array", "string"]},
      "supermarkets": {"type": ["array", "string"]},
      "category": {"type": "string"}
  }
}

Example:

{
  "name": "pepper",
  "units": "tsp",
  "supermarkets": "chinos",
  "category": "spices"
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "name": {"type": "string"},
      "category": {"type": "string"},
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "name": "Onion",
    "category": "Vegetable/Fruit",
    "supermarkets": [
      "Aldi",
      "Edeka"
    ],
    "units": [
      "u",
      "g"
    ]
  }
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}

HTTP status code 409

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 409,
  "message": "The element already exists in the database"
}
×

put /ingredients/single

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "supermarkets": [
      "Aldi"
    ],
    "units": [
      "u"
    ]
  }
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "supermarkets": [
      "Aldi",
      "Edeka"
    ],
    "units": [
      "u",
      "g"
    ]
  }
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
×

delete /ingredients/single

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
    "id": {"type": "string"}
  }
}

Example:

{
  "id": "-M9HqlUQnD7MS-W6kySH"
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "name": {"type": "string"},
      "category": {"type": "string"},
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "name": "Onion",
    "category": "Vegetable/Fruit",
    "supermarkets": [
      "Aldi",
      "Edeka"
    ],
    "units": [
      "u",
      "g"
    ]
  }
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}

/recipes

URI for everything related to the Recipes class

get
×

get /recipes/all

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Recipes response",
  "type": "object",
  "patternProperties": {
    "^.*$": {
      "properties": {
        "name": {"type": "string"},
        "description": {"type": "string"},
        "link": {"type": "string"},
        "ingredients": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "anyOf": [{"type": "object"}],
              "properties": {
                "quantity": {"type": "number"},
                "units": {"type": "string"}
              }
            }
          }
        }
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "name": "Pizza",
    "description": "Aldi pizza with home vegetables",
    "link": "http://www.mypizza.com",
    "ingredients": {
      "-M9HqlJkjgu85S-HGbl58": {
        "quantity": 2,
        "units": "g"
      }
    }
  },
  "-M9HqlUQnD7MS-DS53cKJ": {
    "name": "...",
    "description": "...",
    "link": "...",
    "ingredients": {}
  },
  "-M9HqlUQnD7MS-LKH4c8": {},
  "-M9HqlUQnHJGF-5KJHF4": {}
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
get
post
put
delete
×

get /recipes/single

Query Parameters

  • id: required(string)

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Recipes response",
  "type": "object",
  "patternProperties": {
    "^.*$": {
      "properties": {
        "name": {"type": "string"},
        "description": {"type": "string"},
        "link": {"type": "string"},
        "ingredients": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "anyOf": [{"type": "object"}],
              "properties": {
                "quantity": {"type": "number"},
                "units": {"type": "string"}
              }
            }
          }
        }
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "name": "Pizza",
    "description": "Aldi pizza with home vegetables",
    "link": "http://www.mypizza.com",
    "ingredients": {
      "-M9HqlJkjgu85S-HGbl58": {
        "quantity": 2,
        "units": "g"
      },
      "-M9HqlUQnD7MS-DS53cKJ": {
        "quantity": 5,
        "units": "cups"
      },
      "-M9HqlUQnD7MS-LKH4c8": {},
      "-M9HqlUQnHJGF-5KJHF4": {}
    }
  }
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
×

post /recipes/single

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
    "name": {"type": "string"},
    "description": {"type": "string"},
    "link": {"type": "string"},
    "ingredients": {
      "patternProperties": {
        "^.*$": {
          "properties": {
            "name": {"type": "string"},
            "description": {"type": "string"},
            "link": {"type": "string"},
            "ingredients": {
              "type": "object",
              "patternProperties": {
                "^.*$": {
                  "anyOf": [{"type": "object"}],
                  "properties": {
                    "quantity": {"type": "number"},
                    "units": {"type": "string"}
                  }
                }
              }
            }
          }
        }
      }
    },
    "new_ingredients": {
      "type": "array",
      "items": {
        "properties": {
          "name": {"type": "string"},
          "category": {"type": "string"},
          "supermarkets": {"type": "string"},
          "quantity": {"type": "number"},
          "units": {"type": "string"}
        }
      }
    }
  }
}

Example:

{
  "name": "Pizza",
  "description": "Supermarket pizza with home vegetables",
  "link": "http://www.mypizza.com",
  "ingredients": {
    "-M9HqlJkjgu85S-HGbl58": {
      "quantity": 2,
      "units": "g"
    },
    "-M9HqlUQnD7MS-DS53cKJ": {
      "quantity": 5,
      "units": "cups"
    },
    "-M9HqlUQnD7MS-LKH4c8": {
      "quantity": 7,
      "units": "hand"
    },
    "-M9HqlUQnHJGF-5KJHF4": {
      "quantity": 4,
      "units": "piles"
    }
  },
  "new_ingredients": [
    {
      "name": "Onion",
      "category": "Vegetables/Fruits",
      "supermarkets": "aldi",
      "quantity": 4,
      "units": "piles"
    },
    {
      "name": "Tomato",
      "category": "Vegetables/Fruits",
      "supermarkets": "aldi",
      "quantity": 7,
      "units": "tons"
    }
  ]
}

HTTP status code 201

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
    "name": {"type": "string"},
    "description": {"type": "string"},
    "link": {"type": "string"},
    "ingredients": {
      "patternProperties": {
        "^.*$": {
          "properties": {
            "name": {"type": "string"},
            "description": {"type": "string"},
            "link": {"type": "string"},
            "ingredients": {
              "type": "object",
              "patternProperties": {
                "^.*$": {
                  "anyOf": [{"type": "object"}],
                  "properties": {
                    "quantity": {"type": "number"},
                    "units": {"type": "string"}
                  }
                }
              }
            }
          }
        }
      }
    },
    "new_ingredients": {
      "type": "array",
      "items": {
        "properties": {
          "name": {"type": "string"},
          "category": {"type": "string"},
          "supermarkets": {"type": "string"},
          "quantity": {"type": "number"},
          "units": {"type": "string"}
        }
      }
    }
  }
}

Example:

{
  "name": "Pizza",
  "description": "Supermarket pizza with home vegetables",
  "link": "http://www.mypizza.com",
  "ingredients": {
    "-M9HqlJkjgu85S-HGbl58": {
      "quantity": 2,
      "units": "g"
    },
    "-M9HqlUQnD7MS-DS53cKJ": {
      "quantity": 5,
      "units": "cups"
    },
    "-M9HqlUQnD7MS-LKH4c8": {
      "quantity": 7,
      "units": "hands"
    },
    "-M9HqlUQnHJGF-5KJHF4": {
      "quantity": 4,
      "units": "piles"
    }
  },
  "new_ingredients": [
    {
      "name": "Onion",
      "category": "Vegetables/Fruits",
      "supermarkets": "aldi",
      "quantity": 4,
      "units": "piles"
    },
    {
      "name": "Tomato",
      "category": "Vegetables/Fruits",
      "supermarkets": "aldi",
      "quantity": 7,
      "units": "tons"
    }
  ]
}
×

put /recipes/single

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "supermarkets": [
      "Aldi"
    ],
    "units": [
      "u"
    ]
  }
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "supermarkets": [
      "Aldi",
      "Edeka"
    ],
    "units": [
      "u",
      "g"
    ]
  }
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
×

delete /recipes/single

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
    "id": {"type": "string"}
  }
}

Example:

{
  "id": "-M9HqlUQnD7MS-W6kySH"
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "title": "Ingredients response",
  "type": "object",
  "patternProperties": {
  "^.*$": {
    "properties": {
      "name": {"type": "string"},
      "category": {"type": "string"},
      "supermarkets": {"type": "array"},
      "units": {"type": "array"}
      }
    }
  }
}

Example:

{
  "-M9HqlUQnD7MS-W6kySH": {
    "name": "Onion",
    "category": "Vegetable/Fruit",
    "supermarkets": [
      "Aldi",
      "Edeka"
    ],
    "units": [
      "u",
      "g"
    ]
  }
}

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

HTTP status code 404

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "Reference not found in the data base"
}
post
×

post /recipes/summary

Body

Media type: application/json

Type:

{
  "type": "object",
  "properties": {
    "recipes_ids": {
        "type": "array",
        "items": {"type": "string"}
    }
  }
}

Example:

{
  "recipes_ids": [
    "-M9vmiffPqRjN3zZwFyN",
    "-M9vnZ4nYZ5sJXcariko"
  ]
}

HTTP status code 200

Body

Media type: application/json

Type:

{
  "patternProperties": {
    "^.*$": {
      "type": "number"
    }
  }
}

Examples:

banana tons:

14

ham slices:

4

oregano tbsp:

7

pinaple floz:

4

pinaple u:

4

HTTP status code 400

Body

Media type: application/json

Type: object

Properties

  • message: required(string)
  • code: required(number)

Example:

{
  "code": 400,
  "message": "'u' is not of type 'array'"
}

About

API for storing and retrieving cooking recipes from Firebase Realtime Database and summarizing weekly groceries shopping list.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published