Skip to Content
MySagra 1.4.0 is released šŸŽ‰
API ReferenceIngredients

Ingredients

Manage ingredients that can be associated with food items.

Ingredient Object

{ "id": "clm1234567890", "name": "Mozzarella" }
FieldTypeDescription
idstringUnique identifier (CUID)
namestringIngredient name

GET /v1/ingredients

Retrieve all ingredients.

Authentication: Bearer token

Response 200 OK

[ { "id": "clm1234567890", "name": "Mozzarella" }, { "id": "clm0987654321", "name": "Tomato Sauce" } ]

GET /v1/ingredients/{id}

Retrieve a single ingredient by ID.

Authentication: Bearer token

Path Parameters

ParameterTypeDescription
idstringIngredient ID (CUID)

Response 200 OK

Returns an Ingredient Object.

Errors

StatusDescription
400Invalid ID parameter
404Ingredient not found

POST /v1/ingredients

Create a new ingredient.

Authentication: Bearer token (admin)

Request Body

{ "name": "Mozzarella" }
FieldTypeRequiredDescription
namestringYesIngredient name

Response 201 Created

Returns the created Ingredient Object.

Errors

StatusDescription
400Invalid request body
409Ingredient name already exists

PUT /v1/ingredients/{id}

Update an ingredient.

Authentication: Bearer token (admin)

Path Parameters

ParameterTypeDescription
idstringIngredient ID (CUID)

Request Body

{ "name": "Mozzarella di Bufala" }
FieldTypeRequiredDescription
namestringYesUpdated ingredient name

Response 200 OK

Returns the updated Ingredient Object.

Errors

StatusDescription
400Invalid request body or ID
404Ingredient not found
409Ingredient name already exists

DELETE /v1/ingredients/{id}

Delete an ingredient.

Authentication: Bearer token (admin)

Path Parameters

ParameterTypeDescription
idstringIngredient ID (CUID)

Response 204 No Content

Errors

StatusDescription
400Invalid ID parameter
404Ingredient not found
Last updated on