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

NameInTypeRequiredDescription
titlequerystringfalsenone
ingredientsqueryarray[string]falsenone
nutritionFactsqueryarray[string]falsenone

Enumerated Values

ParameterValue
nutritionFactsLOW_CALORIE
nutritionFactsHIGH_CALORIE
nutritionFactsHIGH_PROTEIN
nutritionFactsCARBS

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

StatusMeaningDescriptionSchema
200OKOKInline
500Internal Server ErrorInternal Server ErrorError

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
anonymous[Recipe]falsenonenone
» titlestringfalsenoneTitle of the recipe
» ingredients[Ingredient]falsenoneList of ingredients
»» namestringfalsenoneName of the ingredient
»» quantitynumber(double)falsenoneQuantity depending on unit
»» unitstringfalsenoneQuantifying unit of the ingredient (grams, milliliters, count, tablespoon)
» preparationTimeinteger(int32)falsenonePreparation time (in minutes)
» cookingTimeinteger(int32)falsenoneCooking time (in minutes)
» servingsinteger(int32)falsenoneServed for persons
» instructions[string]falsenoneStep by step instructions
» nutritionFacts[string]falsenoneNutrition 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

NameInTypeRequiredDescription
bodybodyRecipetruenone

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

StatusMeaningDescriptionSchema
201CreatedCreatedRecipe
500Internal Server ErrorInternal Server ErrorError

Schemas

Error

{
  "code": "UNEXPECTED",
  "message": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
codestringfalsenonenone
messagestringfalsenonenone

Enumerated Values

PropertyValue
codeUNEXPECTED
codeNOT_FOUND

Ingredient

{
  "name": "Kidney beans",
  "quantity": 250,
  "unit": "grams"
}

List of ingredients

Properties

NameTypeRequiredRestrictionsDescription
namestringfalsenoneName of the ingredient
quantitynumber(double)falsenoneQuantity depending on unit
unitstringfalsenoneQuantifying 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

NameTypeRequiredRestrictionsDescription
titlestringfalsenoneTitle of the recipe
ingredients[Ingredient]falsenoneList of ingredients
preparationTimeinteger(int32)falsenonePreparation time (in minutes)
cookingTimeinteger(int32)falsenoneCooking time (in minutes)
servingsinteger(int32)falsenoneServed for persons
instructions[string]falsenoneStep by step instructions
nutritionFacts[string]falsenoneNutrition facts