Skip to content

API Documentation

Fernando Andreu edited this page Jul 11, 2019 · 4 revisions

This page describes all available endpoints for the REST API powering up the recipe manager tool.

The REST API is available at: https://recipemanager.azurewebsites.net

Search queries for recipes

Searching recipes that fulfill some criteria is done in the GET /recipes endpoint, using the search query parameter. For example, to find a recipe whose title contains the word Fajitas, try the following (co is shorthand for contains):

GET /recipes?search=title co fajitas

On the other hand, if you just want a recipe whose title is exactly Fajitas, try the eq (equals) operator instead:

GET /recipes?search=title eq fajitas

The most interesting property to query for is ingredients, namely with the co operator. On its simplest form, it will list all recipes containing the particular ingredient you specified:

GET /recipes?search=ingredients co eggs

In addition, after specifying the ingredient name, you can also specify the quantity to search for. For example, to find recipes needing less than 5 eggs:

GET /recipes?search=ingredients co eggs lt 5

The available operators are lt, le, eq ge and gt, which correspond to less than, less than or equal to, equal to, greater than or equal to and greater than respectively.

When querying ingredients with mass / volume units, these can be appended after the quantity. For example, to find recipes with more than 100g sugar:

GET /recipes?search=ingredients co sugar gt 100g

Several different units are available, such as g, kg, ml, oz, tbsp, etc.

The search query parameter can also be repeated multiple times to specify more than one condition that has to be fulfilled. For example, to find recipes that contain more than 5 eggs but less than 500g sugar:

GET /recipes?search=ingredients co eggs gt 5&search=ingredients co sugar lt 500g

Other considerations:

  • All text searches are case insensitive except when specifying units (e.g. kg, tbsp).

Clone this wiki locally