Recipes API Reference (widdershins)
Recipes API v1.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Recipes API - API First example
Base URLs:
Recipes API
List all recipes
Code samples
# You can also use wget
curl -X GET http://localhost:8080/recipes \
-H 'Accept: application/json'
GET /recipes
Shows recipes based on search criteria
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
title | query | string | false | none |
ingredients | query | array[string] | false | none |
nutritionFacts | query | array[string] | false | none |
Enumerated Values
Parameter | Value |
---|---|
nutritionFacts | LOW_CALORIE |
nutritionFacts | HIGH_CALORIE |
nutritionFacts | HIGH_PROTEIN |
nutritionFacts | CARBS |
Example responses
200 Response
[
{
"title": "Chilli sin Carne",
"ingredients": [
{
"name": "Kidney beans",
"quantity": 250,
"unit": "grams"
}
],
"preparationTime": 30,
"cookingTime": 15,
"servings": 4,
"instructions": [
"string"
],
"nutritionFacts": [
"LOW_CALORIE"
]
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
500 | Internal Server Error | Internal Server Error | Error |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [Recipe] | false | none | none |
» title | string | false | none | Title of the recipe |
» ingredients | [Ingredient] | false | none | List of ingredients |
»» name | string | false | none | Name of the ingredient |
»» quantity | number(double) | false | none | Quantity depending on unit |
»» unit | string | false | none | Quantifying unit of the ingredient (grams, milliliters, count, tablespoon) |
» preparationTime | integer(int32) | false | none | Preparation time (in minutes) |
» cookingTime | integer(int32) | false | none | Cooking time (in minutes) |
» servings | integer(int32) | false | none | Served for persons |
» instructions | [string] | false | none | Step by step instructions |
» nutritionFacts | [string] | false | none | Nutrition facts |
Create a recipe
Code samples
# You can also use wget
curl -X POST http://localhost:8080/recipes \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST /recipes
Creates a recipe and stores it
Body parameter
{
"title": "Chilli sin Carne",
"ingredients": [
{
"name": "Kidney beans",
"quantity": 250,
"unit": "grams"
}
],
"preparationTime": 30,
"cookingTime": 15,
"servings": 4,
"instructions": [
"string"
],
"nutritionFacts": [
"LOW_CALORIE"
]
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Recipe | true | none |
Example responses
201 Response
{
"title": "Chilli sin Carne",
"ingredients": [
{
"name": "Kidney beans",
"quantity": 250,
"unit": "grams"
}
],
"preparationTime": 30,
"cookingTime": 15,
"servings": 4,
"instructions": [
"string"
],
"nutritionFacts": [
"LOW_CALORIE"
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | Created | Recipe |
500 | Internal Server Error | Internal Server Error | Error |
Schemas
Error
{
"code": "UNEXPECTED",
"message": "string"
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | string | false | none | none |
message | string | false | none | none |
Enumerated Values
Property | Value |
---|---|
code | UNEXPECTED |
code | NOT_FOUND |
Ingredient
{
"name": "Kidney beans",
"quantity": 250,
"unit": "grams"
}
List of ingredients
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
name | string | false | none | Name of the ingredient |
quantity | number(double) | false | none | Quantity depending on unit |
unit | string | false | none | Quantifying unit of the ingredient (grams, milliliters, count, tablespoon) |
Recipe
{
"title": "Chilli sin Carne",
"ingredients": [
{
"name": "Kidney beans",
"quantity": 250,
"unit": "grams"
}
],
"preparationTime": 30,
"cookingTime": 15,
"servings": 4,
"instructions": [
"string"
],
"nutritionFacts": [
"LOW_CALORIE"
]
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
title | string | false | none | Title of the recipe |
ingredients | [Ingredient] | false | none | List of ingredients |
preparationTime | integer(int32) | false | none | Preparation time (in minutes) |
cookingTime | integer(int32) | false | none | Cooking time (in minutes) |
servings | integer(int32) | false | none | Served for persons |
instructions | [string] | false | none | Step by step instructions |
nutritionFacts | [string] | false | none | Nutrition facts |