Recipes

Route Guide

Getting Recipes

Get all recipes in a paginated manner

GET domain.api/api/v1/recipes/:skip/:limit

Provides an array of JSON Objects

Path Parameters

Name
Type
Description

:skip*

Integer

Number of records to skip from the beginning of the list of recipes.

:limit*

Integer

Number of records, after the skipped records, to return from the list of recipes.

{
  "code": 200,
  "data": [...]
}

Get recipe by id

GET domain.api/api/v1/recipes/:id

Provides a JSON Object

Path Parameters

Name
Type
Description

:id*

String

ID of the recipe

{
    "_id": "...",
    "name": "...",
    "author": "...",
    "cooking_time": 0,
    "diet": "...",
    "img_url": "...",
    "ingredients": [
        {
            "name": "...",
            "steps": [1, 2],
            "category": "other | veggies | meat | dairy"
        },
        ...
    ],
    "steps": [
        "...",
        "...",
        "..."
    ],
    "allergies": [
        "...",
        "..."
    ],
    "intro": "...",
    "desc": "...",
    "health_score": 5,
    "health_reason": "...",
    "userId": "..."
}

Get all recipes published by the authenticated user

GET domain.api/api/v1/recipes/:skip/:limit

Provides an array of JSON Objects

Path Parameters

Name
Type
Description

:skip*

Integer

Number of records to skip from the beginning of the list of recipes.

:limit*

Integer

Number of records, after the skipped records, to return from the list of recipes.

Headers

Name
Type
Description

Authorization*

Bearer Token

Bearer Token supplied by Clerk after user has authenticated.

{
  "code": 200,
  "data": [...]
}

Publishing Recipes

Publish recipe content

POST domain.api/api/v1/recipes

Requires JSON Body

Returns JSON Object

Headers

Name
Type
Description

Authorization*

Bearer Token

Bearer Token supplied by Clerk after user has authenticated.

Content-Type*

application/json

Request Body

Name
Type
Description

name*

String

Name/title of the recipe.

cookingTime*

Number

Time (mins) required to make this recipe.

steps*

String Array

Array of steps to make the recipe.

submission_id

String

Existing submission id, assigned upon an image upload.

The submission will be continued on the same id and the uploaded image will be attached to the recipe (if the recipe submission is accepted). AI will not generate an image.

{
  "code": 200,
  "spam": true,
  "msg": "[Reason for spam categorisation]"
}

Initialise a recipe submission with an image upload and await content.

POST domain.api/api/v1/recipes/images/upload

Returns a JSON Object

Must be followed up with a request to publish recipe content within 48 hours or image will be deleted.

Do not include a Content-Type header.

Headers

Name
Type
Description

Authorization*

Bearer Token

Bearer Token supplied by Clerk after user has authenticated.

Request Body

Name
Type
Description

image*

Binary

Image File

{
    "code": 201
    "submission_id": "..."
}

Deleting Recipes

Delete recipe by id

DELETE domain.api/api/v1/recipes/:id

Provides a JSON Object

Path Parameters

Name
Type
Description

:id*

String

ID of the recipe

{
    "code": 200
    "msg": "Deleted item with _id ..."
}

Editing Recipes

Modify recipe content

PUT domain.api/api/v1/recipes

Returns JSON Object if successful

Headers

Name
Type
Description

Authorization*

Bearer Token

Bearer Token supplied by Clerk after user has authenticated.

Content-Type*

application/json

Request Body

Name
Type
Description

name*

String

Name/title of the recipe.

cookingTime*

Number

Time (mins) required to make this recipe.

steps*

String Array

Array of steps to make the recipe.

intro*

String

Introduction of the recipe.

desc*

String

Description of the recipe.

ingredients*

Object Array

Array of objects describing ingredients used (identical to the ingredient array in Recipe Object)

{
  "code": 200,
  "spam": true,
  "msg": "[Reason for spam categorisation]"
}

Upload and replace image on an existing recipe

PUT domain.api/api/v1/recipes/images/upload

Returns a JSON Object

Headers

Name
Type
Description

Authorization*

Bearer Token

Bearer Token supplied by Clerk after user has authenticated.

Request Body

Name
Type
Description

image*

Binary

Image File

{
    "code": 200
}

Last updated

Was this helpful?