GithubHelp home page GithubHelp logo

be_zero_waste_kitchen's Introduction

zero_waste_kitchen

ZWK JSON Contract

Fetch One User

GET '/api/v1/users/:id’

Example response of the User resource

{
  "data": {
    "id": "integer",
    "type": "string",
    "attributes": {
      "first_name": "string",
      "last_name": "string",
      "username": "string",
      "email": "string",
      "stats": {
        "lions_saved": "integer",
        "recipes_cooked": "integer",
        "recipes_created": "integer"
      }
    }
  }
}

Create One User

POST '/api/v1/users’

Example of the body details to be provided when creating a user

{
  "first_name": "string",
  "last_name": "string",
  "username": "string",
  "email": "string",
  "password": "string",
  "password_confirmation": "string"
}

Create a Recipe

POST ‘/api/v1/user/:user_id/recipes’

Example of the body details to be provided when creating a cooked recipe

{
  "user_id": "integer",
  "recipe_id": "integer",
  "instructions": "string",
  "image_url": "string",
  "cook_time": "integer",
  "public_status": "boolean"
}

Create a Cooked Recipe (user_recipes)

POST ‘/api/v1/user/:user_id/recipes/:recipe_id?value=cooked’

Example of the body details to be provided when creating a cooked recipe

{
  "user_id": "integer",
  "recipe_id": "integer",
  "cook_status": "boolean"
}

Create a Saved Recipe (user_recipes)

POST ‘/api/v1/user/:user_id/recipes/:recipe_id?value=saved’

Example of the body details to be provided when creating a saved recipe

{
  "user_id": "integer",
  "recipe_id": "integer",
  "saved_status": "boolean"
}

Update a Cooked Recipe (user_recipes)

PATCH ‘/api/v1/user/:user_id/recipes/:recipe_id?value=rate’

Example of the body details to be provided when updating (rating) a cooked recipe

{
  "user_id": "integer",
  "recipe_id": "integer",
  "cook_status": "boolean",
  "num_stars": "integer"
}

Update One User

PATCH '/api/v1/users/:id’

Example of the body details to be provided when updating a user

{
  "id": "integer",
  "name": "string",
  "username": "string",
  "email": "string"
}

Fetch One Users Cooked Recipes

GET '/api/v1/users/:id/recipes?value=cooked'

Example response of a Users Recipes resource

Params: value=cooked

{
  "data": [
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string"
      }
    },
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string"
      }
    }
  ]
}

Fetch One Users Created Recipes

GET '/api/v1/users/:id/recipes?value=created'

Example response of a Users Recipes resource

Params: value=created

{
  "data": [
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string"
      }
    },
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string"
      }
    }
  ]
}

Fetch One Users Saved Recipes

GET '/api/v1/users/:id/recipes?value=saved'

Example response of a Users Recipes resource

Params: value=saved

{
  "data": [
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string"
      }
    },
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string"
      }
    }
  ]
}

Fetch One Saved Recipes

GET '/api/v1/recipes/:id'

Example response of a Recipes resource

{
  "id": "string",
  "type": "string",
  "attributes": {
    "image_url": "string",
    "name": "string",
    "rating_from_api": "float",
    "cook_time": "integer",
    "public_status": "boolean",
    "ingredients": [
      {
        "name": "string",
        "units": "float",
        "unit_type": "string"
      },
      {
        "name": "string",
        "units": "float",
        "unit_type": "string"
      }
    ],
    "source_name": "string",
    "source_url": "string",
    "instructions": ["string", "string", ...]
  }
}

Update One Recipe

PATCH '/api/v1/user/:user_id/recipes/:recipe_id’

Example of the body details to be provided when updating a recipe

{
  "user_id": "integer",
  "recipe_id": "integer",
  "name": "string",
  "cook_time": "integer",
  "source_name": "string"
}

Delete One Recipe

DELETE '/api/v1/user/:user_id/recipes/:recipe_id’

Example of the body details to be provided when deleting a recipe

{
  "user_id": "integer",
  "recipe_id": "integer"
}

Fetch One Users Friends (chefs)

GET '/api/v1/users/:id/chefs’

Example response of the Users Chefs resource

{
  "data": [
  {
    "id": "string",
    "type": "string",
    "attributes": {
      "name": "string",
      "username": "string"
    },
  {
    "id": "string",
    "type": "string",
    "attributes": {
      "name": "string",
      "username": "string"
    }
  }
}

Fetch all ingredients

GET '/api/v1/ingredients'

Example response of the Ingredients resource

{
  "data": [
    {
      "name": "string"
    },
    {
      "name": "string"
    },
    {
      "name": "string"
    }
  ]
}

Fetch searched recipes --> by Name

GET ‘/api/v1/recipes/search?name=query%string’

Example of a response from the Search (by name) resource

{
  "data": [
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string",
      }
    },
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string",
      }
    }
  ]
}

Fetch searched recipes --> by Ingredients

GET ‘/api/v1/recipes/search?ingredient=query%string,+query’

Example of a response from the Search (by ingredients(s) ) resource

{
  "data": [
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string",
      }
    },
    {
      "id": "string",
      "type": "string",
      "attributes": {
        "name": "string",
      }
    }
  ]
}

be_zero_waste_kitchen's People

Contributors

blowrey24 avatar calforcal avatar kdhubb avatar mwmjohnson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.