Skip to content

Latest commit

 

History

History
106 lines (104 loc) · 3.3 KB

README.org

File metadata and controls

106 lines (104 loc) · 3.3 KB

Fodsearch API

The fodmap ingredient API.

About

Information about low fodmap ingredients are scattered about the web, in plain text, images, web apps, etc. This API is an effort to put all low fodmap ingredients into a single place to make them easier to find.

This is a work in progress!

Starting

To start the server from the CLI run:

clj -M:start

This starts a server at localhost:3000

Endpoints

Health

GET /api/v1/health

A health check (this should return true!)

curl "http://localhost:3000/api/ingredients"

Ingredients

GET /api/v1/ingredients

Get list of all ingredients.

curl "http://localhost:3000/api/ingredients"

GET /api/v1/ingredients?q=melon

Search for ingredients that match the query q

curl "http://localhost:3000/api/ingredients?q=melon"

GET /api/v1/ingredients/:ingredient-id

Get a single ingredient by its id.

curl "http://localhost:3000/api/ingredients/1"

DELETE /api/v1/ingredients/:ingredient-id

Delete a single ingredient by its id.

curl -X DELETE "http://localhost:3000/api/ingredients/1"

POST /api/v1/ingredients

Create a single ingredient.

curl -X POST -d '{"name": "Test Ingredient", "info": "none", "type":"moderate","category":"fruit"}' "http://localhost:3000/api/ingredients"

PUT /api/v1/ingredients/1

Update a single ingredient by its id.

curl -X POST -d '{"name": "Better Alfalfa", "info": "none", "type":"moderate","category":"fruit"}' "http://localhost:3000/api/ingredients/1"

The given type and category need to exist for this to be successful.

Types

GET /api/v1/types

Get a list of all types.

curl "http://localhost:3000/api/types"

GET /api/v1/types/:type-id

Get a single category by its id.

curl "http://localhost:3000/api/types/1"

POST /api/v1/types

Create a single type.

curl -X POST -d '{"name": "Test Type"}' "http://localhost:3000/api/types"

PUT /api/v1/types/1

Update a single type by its id.

curl -X POST -d '{"name": "unsafe"}' "http://localhost:3000/api/types/1"

DELETE /api/v1/ingredients/:type-id

Delete a single type by its id.

curl -X DELETE "http://localhost:3000/api/type/1"

This will not work if the type is being used by an ingredient.

Categories

GET /api/v1/categories

Get a list of all categories.

curl "http://localhost:3000/api/categories"

GET /api/v1/categories/:category-id

Get a single category by its id.

curl "http://localhost:3000/api/categories/1"

POST /api/v1/categories

Create a single category.

curl -X POST -d '{"name": "Test Category"}' "http://localhost:3000/api/categories"

PUT /api/v1/categories/1

Update a single category by its id.

curl -X POST -d '{"name": "veggies"}' "http://localhost:3000/api/types/1"

DELETE /api/v1/categories/:category-id

Delete a single category by its id.

curl -X DELETE "http://localhost:3000/api/categories/1"

This will not work if the category is being used by an ingredient.