KutologoJM's Portfolio

View My GitHub Profile

Ingredients Model

Fields:

GET Method

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

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

GET <api>/ingredients/?ordering=<field_name>
# This will allow you to sort all the ingredient by your desired field.
example field names:
    - slug
    - names
    - spoil_time
ascending: field_name
descending: -field_name
GET <api>/ingredients/1/
{
    "name": "Frost Bun",
    "description": "A simple bun baked from Sleet Wheat Grain.\r\nEach bite leaves a mild cooling sensation in one's mouth, even when the bun itself is warm.",
    "slug": "frost-bun",
    "dlc": "Base",
    "ingredient_image_url": "https://oxygennotincluded.wiki.gg/images/Resource_Frost_Bun.png?91f368=&format=original",
    "spoil_time": 8,
    "food_quality": {
        "Quality": "Standard",
        "Morale impact": "+2"
    },
    "kcal_per_kg": 1200,
    "source": "Electric Grill",
    "source_image_url": "https://oxygennotincluded.wiki.gg/images/9/97/Electric_Grill.png?7e3bb5=&format=original"
}

POST Method

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

# An example of a ingredient being added, in this case the "Frost Bun".
POST {
    "name": "Frost Bun",
    "description": "A simple bun baked from Sleet Wheat Grain.\r\nEach bite leaves a mild cooling sensation in one's mouth, even when the bun itself is warm.",
    "dlc": "Base",
    "ingredient_image_url": "https://oxygennotincluded.wiki.gg/images/Resource_Frost_Bun.png?91f368=&format=original",
    "spoil_time": 8,
    "food_quality": {
        "Quality": "Standard",
        "Morale impact": "+2"
    },
    "kcal_per_kg": 1200,
    "source": "Electric Grill",
    "source_image_url": "https://oxygennotincluded.wiki.gg/images/9/97/Electric_Grill.png?7e3bb5=&format=original"
}

PATCH / PUT Method

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

# An example patch changing the ingredient with id 3's dlc from Base to PPP!.
PATCH / PUT <api>/ingredient/3/
{
    "name": "Frost Bun",
    "description": "A simple bun baked from Sleet Wheat Grain.\r\nEach bite leaves a mild cooling sensation in one's mouth, even when the bun itself is warm.",
    "dlc": "PPP!",
    "ingredient_image_url": "https://oxygennotincluded.wiki.gg/images/Resource_Frost_Bun.png?91f368=&format=original",
    "spoil_time": 8,
    "food_quality": {
        "Quality": "Standard",
        "Morale impact": "+2"
    },
    "kcal_per_kg": 1200,
    "source": "Electric Grill",
    "source_image_url": "https://oxygennotincluded.wiki.gg/images/9/97/Electric_Grill.png?7e3bb5=&format=original"
}

DELETE Method

DELETE <api>/ingredients/1/
# Deletes the ingredient with the given ID.