recipedb API
recipedb uses GraphQL.
The only endpoint is /api, which accepts GET requests for queries and POST requests for mutations. In addition to the documentation below, you can download the API schema in JSON.
Authentication
Some requests require authentication, others may return user-specific data or perform user-specific actions. The API uses simple token authentication: set the "Authentication" header to "bearer: api token" when making requests. To generate a token, authenticate with the login mutation after you create an account.
Documentation Syntax
The documentation below uses standard GraphQL type syntax. For example: Field! means that the field is non-nullable, [ObjType] represents an array of ObjType objects, etc.
Example Query
GET https://recipedb.herokuapp.com/api?query=query{search(query:"milk"){name,name,__typename}}
Queries
search (query:String!) [RecipeIngredient]
Returns a list of ingredients and recipes whose name matches query.
ingredient (_id:ID!) Ingredient
Returns the ingredient with the provided ID.
ingredients (filter:JSON) [Ingredient!]!
recipe (_id:ID!) Recipe
Returns the recipe with the provided ID.
randomRecipe (filter:JSON) Recipe
recipes (filter:JSON) [Recipe!]!
user (email:String) User
Returns the user for the provided email address. Only admins have access to users other than themselves.
category (name:String!) Category
Returns the category with the provided name.
categories () [Category]
Returns all categories.
pairing (query:String!) [Pairing]
Returns pairings for an ingredient.
Mutations
login (email:String!, password:String!) AuthenticationResponse
logout () Boolean
updateIngredient (ingredient:IngredientInput) Ingredient
removeIngredient (_id:ID) JSON
updateRecipe (recipe:RecipeInput) Recipe
removeRecipe (_id:ID) JSON
updateUser (user:UserInput) User
Interfaces
RecipeIngredient
Possible types: Ingredient, Recipe
_id: ID!
The ID of the recipe or ingredient
name: String
The name of the recipe or ingredient
categories: [Category]
The categories of which the recipe or ingredient is a member