跳转到主要内容

Supplies

Supplies represent orders delivered by specific suppliers in the supply chain. They contain a list of ingredients — the same ingredient object as in recipes — and can serve as the data pool for Eaternity Reports, as well as provide feedback on individual purchases.

For a complete request and response, see the use case Supplies for supply-based reports.

Overview​

Use the Supply API to:

  • Track ingredient purchases from suppliers
  • Calculate CO₂ footprint of supply chain deliveries
  • Generate data for Eaternity Reports on procurement sustainability
  • Analyze environmental impact per supplier

Query Parameters​

All supply endpoints take the query parameters full-resource, indicators, return-uids, transient and ingredients-declaration. Values and defaults: Query Parameters.

Supply Properties​

Ingredients

Each delivered article is an ingredient object. Fields, allowed values and matching: Ingredients.

Request Properties​

PropertyTypeRequiredDescription
idStringNoSupply identifier. Either generated by Eaternity or supplied by the client through a PUT.
kitchen-idStringBatch onlyThe kitchen the supply belongs to. Required in POST /supplies/batch; on kitchen-scoped routes the kitchen comes from the URL.
supplierStringNoName of the specific supplier in the supply chain
supplier-idStringNoYour identifier for the supplier
invoice-idStringNoInvoice number (if different from the supply ID)
order-dateDateNoThe date the supply was ordered. Format: YYYY-MM-DD
supply-dateDateBest practiceThe delivery date of the supply. Reports count the supply on this date. Format: YYYY-MM-DD
ingredientsArrayYesThe delivered articles, as ingredient objects. See Ingredients.

Request Example​

POST /supplies/batch
[
{
"request-id": 1,
"supply": {
"id": "d1ed2263",
"kitchen-id": "kitchen-restaurant-a",
"supplier": "Vegetable Supplies Ltd.",
"supplier-id": "el3i5y-2in5y-2hbllll01",
"supply-date": "2013-06-01",
"ingredients": [
{
"id": "100100191",
"type": "conceptual-ingredients",
"names": [
{
"language": "de",
"value": "Tomaten"
}
],
"amount": 150,
"unit": "gram",
"origin": "spain",
"transport": "air",
"production": "greenhouse",
"processing": "raw",
"conservation": "fresh",
"packaging": "plastic"
}
]
}
}
]

Response Properties (with full-resource=true)​

PropertyTypeDescription
idStringSupply identifier
kitchen-idStringThe kitchen this supply belongs to
co2-valueFloatTotal CO₂ value of the supply in grams CO₂e
info-textStringNotes on the calculation (e.g., "Two ingredient origins have been estimated.")
supplierStringSupplier name
supplier-idStringSupplier identifier
supply-dateStringDelivery date
ingredientsArrayIngredients with individual ratings and CO₂ values
indicatorsObjectEnvironmental indicators (when indicators=true is set)

Response Example (GET with full-resource=true)​

The batch answers with one status entry per supply, [{"statuscode": 200, "message": "", "supply-id": "d1ed2263", "request-id": 1}]. The values come with GET /kitchens/kitchen-restaurant-a/supplies/d1ed2263?full-resource=true:

{
"statuscode": 200,
"message": "",
"supply-id": "d1ed2263",
"supply": {
"food-unit": 0.12,
"final-weight-per-portion": 150.0,
"co2-value": 169,
"rating": "C",
"co2-value-improvement-percentage": -82,
"co2-value-reduction-value": -76,
"kitchen-id": "kitchen-restaurant-a",
"supplier": "Vegetable Supplies Ltd.",
"supplier-id": "el3i5y-2in5y-2hbllll01",
"supply-date": "2013-06-01",
"ingredients": [
{
"foodUnit": 0.12,
"co2-value": 169,
"rating": "C",
"co2-value-improvement-percentage": -82,
"co2-value-reduction-value": -76,
"bar-chart": 100,
"id": "100100191",
"type": "conceptual-ingredients",
"names": [{"language": "de", "value": "Tomaten"}],
"amount": 150.0,
"unit": "gram",
"origin": "spain",
"transport": "air",
"production": "greenhouse",
"processing": "raw",
"conservation": "fresh",
"packaging": "plastic"
}
],
"id": "d1ed2263"
}
}

Batch Operations​

Supplies support batch creation via POST /supplies/batch. Multiple supplies can be created or updated in a single request; each supply names its kitchen-id.

Each supply in the batch can include a request-id to track individual items in the response. Either a request-id or a supply id is required per entry.

Kitchen-Scoped Endpoints​

Supplies are managed under a specific kitchen:

MethodEndpointDescription
POST/kitchens/{kitchen_id}/supplies/Create a single supply (ID generated by Eaternity)
GET/kitchens/{kitchen_id}/supplies/List all supply IDs in this kitchen
GET/kitchens/{kitchen_id}/supplies/{supply_id}Get a specific supply
PUT/kitchens/{kitchen_id}/supplies/{supply_id}Update or create a supply with a specific ID
DELETE/kitchens/{kitchen_id}/supplies/{supply_id}Delete a supply

Endpoints​