KutologoJM's Portfolio

View My GitHub Profile

Recipe Ingredients Model

Fields:

GET Method

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

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

GET <api>/recipe-ingredients/?ordering=<field_name>
# This will allow you to sort all the recipe-ingredient relationships by your desired field.
example field names:
    - recipe
    - ingredient
    - role
ascending: field_name
descending: -field_name
GET <api>/recipe-ingredients/1/
{
  "recipe": "Frost Burger",
  "ingredient": {
    "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"
  },
  "amount_required": 1200,
  "unit": "kcal",
  "role": "main"
}

POST Method

#  Allows you to create a new recipe and ingredient relationship.
POST {
  "recipe_id": null,
  "ingredient_id": null,
  "amount_required": null,
  "unit": "",
  "role": null
}
# An example of a recipe "Frost Burger" and Ingredient "Frost Bun" relationship being created.
POST {
  "recipe": "Frost Burger",
  "ingredient": {
    "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"
  },
  "amount_required": 1200,
  "unit": "kcal",
  "role": "main"
}

PATCH / PUT Method

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

# An example patch changing the associated recipe from "Frost Burger" to "Surf'n'Turf"
PATCH / PUT <api>/recipe-ingredients/1/
{
  "recipe": "Surf'n'Turf",
  "ingredient": {
    "name": "Barbeque",
    "description": "The cooked meat of a defeated critter.\r\nIt has a delightful smoky aftertaste.",
    "slug": "barbeque",
    "dlc": "Base",
    "ingredient_image_url": "https://oxygennotincluded.wiki.gg/images/Resource_Barbeque.png?512e4c=&format=original",
    "spoil_time": 4,
    "food_quality": {
      "Quality": "Good",
      "Morale impact": "+3"
    },
    "kcal_per_kg": 4000,
    "source": "Electric Grill",
    "source_image_url": "https://oxygennotincluded.wiki.gg/images/9/97/Electric_Grill.png?7e3bb5=&format=original"
  },
  "amount_required": 4000,
  "unit": "kcal",
  "role": "main"
}

DELETE Method

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