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

Output Objects

Category

name: String

members: [RecipeIngredient]

Ingredient

_id: ID!

name: String

meta: [Meta]

recipes: [Recipe]

pairings: [JSON]

categories: [Category]

dietary: JSON

Meta

k: String

v: JSON

Recipe

_id: ID!

name: String

procedure: [Step]

meta: [Meta]

categories: [Category]

dietary: JSON

Step

ingredients: [StepIngredient]

procedure: String

StepIngredient

ingredient: RecipeIngredient

quantity: String

type: String

User

_id: ID!

email: String

recipes: [Recipe]

Pairing

_id: ID!

name: String!

pairings: [String]!

AuthenticationResponse

user: User

token: String

Input Objects

IngredientInput

_id: ID

name: String

meta: [MetaInput]

categories: [CategoryInput]

dietary: JSON

MetaInput

k: String!

v: JSON

CategoryInput

name: String

RecipeInput

_id: ID

name: String

procedure: [StepInput]

meta: [MetaInput]

categories: [CategoryInput]

StepInput

ingredients: [StepIngredientInput]

procedure: String

StepIngredientInput

ingredient: IngredientInput

_id: ID

quantity: String

type: String

UserInput

_id: ID

email: String

password: String