KutologoJM's Portfolio

View My GitHub Profile

Recipes Model

Fields:

GET Method

GET <api>/recipes/1/
# This will allow you to view a specific recipe based on its ID.

GET <api>/recipes/
# This will display all recipes currently saved within the model.

GET <api>/recipes/?ordering=<field_name>
# This will allow you to sort all the recipes by your desired field.
example field names:
    - slug
    - names
    - spoil_time
ascending: field_name
descending: -field_name

To view an example of what the GET method returns, please click here.

POST Method

#  Allows you to create a new recipe.
POST {
  "name": "",
  "description": "",
  "image_url": "",
  "dlc": "",
  "food_quality":,
  "spoil_time": ,
  "kcal_per_kg": ,
  "source": "",
  "source_image_url": "",
  "calories_produced": 
}

# An example of a recipe being added, in this case the "Frost Burger".
POST {
    "name": "Frost Burger",
    "description": "Meat and Lettuce on a chilled Frost Bun.\r\nIt's the only burger ever to be served cold.",
    "image_url": "https://oxygennotincluded.wiki.gg/images/Resource_Frost_Burger.png?5bef19&format=original",
    "dlc": "Base",
    "food_quality": {
        "Morale impact": "+6",
        "Quality": "Ambrosial"
    },
    "spoil_time": 4,
    "kcal_per_kg": 6000,
    "source": "Gas Range",
    "source_image_url": "https://oxygennotincluded.wiki.gg/images/Gas_Range.png?caa6a2=&format=original",
    "calories_produced": 6000
}

PATCH / PUT Method

# Allows you to modify a part or all of a given recipe
PATCH / PUT <api>/recipes/1/
{
  "name": "",
  "description": "",
  "image_url": "",
  "dlc": "",
  "food_quality":,
"spoil_time": ,
"kcal_per_kg": ,
"source": "",
"source_image_url": "",
"calories_produced":
}

# An example patch changing the recipe with id 1's morale impact from 6 to 5.
PATCH / PUT <api>/recipes/1/
{
    "name": "Frost Burger",
    "description": "Meat and Lettuce on a chilled Frost Bun.\r\nIt's the only burger ever to be served cold.",
    "image_url": "https://oxygennotincluded.wiki.gg/images/Resource_Frost_Burger.png?5bef19&format=original",
    "dlc": "Base",
    "food_quality": {
        "Morale impact": "+5",
        "Quality": "Superb"
    },
    "spoil_time": 4,
    "kcal_per_kg": 6000,
    "source": "Gas Range",
    "source_image_url": "https://oxygennotincluded.wiki.gg/images/Gas_Range.png?caa6a2=&format=original",
    "calories_produced": 6000
}

DELETE Method

DELETE <api>/recipes/1/
# Deletes the recipe with the given ID.