diff --git a/rest-references/index.html b/rest-references/index.html index 9a32b14..8210986 100644 --- a/rest-references/index.html +++ b/rest-references/index.html @@ -599,6 +599,15 @@ + + +
  • + + + Delete recipes + + +
  • @@ -884,6 +893,15 @@ + + +
  • + + + Delete recipes + + +
  • @@ -1334,7 +1352,7 @@
    ResponsesExample cURL
    -
     curl --location 'localhost:8080/api/recipe/trending' --header 'X-Auth-Header: X_AUTH_HEADER
    +
     curl --location 'localhost:8080/api/recipe/trending' --header 'X-Auth-Header: X_AUTH_HEADER
     
    @@ -1580,12 +1598,81 @@
    Example cURL +

    Delete recipes

    +
    +DELETE /api/recipe/pk:int/ +
    Parameters
    + + + + + + + + + + + + + + + + + +
    nametypedata typedescription
    <int:pk>path (required)intRecipe primary key to be deleted
    +
    Headers
    + + + + + + + + + + + + + + + + + +
    nametypedata typedescription
    AuthorizationrequiredAccess TokenToken obtained from login endpoint example "token 443c104be8c6daeeaf86df634e69b97668b99900"
    +
    Responses
    + + + + + + + + + + + + + + + + + + + + +
    http codecontent-typeresponse
    204application/json
    401application/json{"detail":"Authentication credentials were not provided."}
    +
    Example cURL
    +
    +
     curl --location --request DELETE 'host/api/recipe/<int:pk>/' --header 'Authorization: Token d8916a5f6cf16d2c6a87bc7461bc4680245609f0' 
    +
    +
    +

    Category

    Get all categories

    GET /api/recipe/trending -
    Headers
    +
    Headers
    @@ -1604,7 +1691,7 @@
    HeadersResponses
    +
    Responses
    @@ -1626,16 +1713,16 @@
    ResponsesExample cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/category' --header 'X-Auth-Header: X_AUTH_HEADER'
    +
     curl --location 'host/api/recipe/category' --header 'X-Auth-Header: X_AUTH_HEADER'
     

    Get all categories recipes

    GET /api/recipe/category/int:pk/recipes -
    Parameters
    +
    Parameters
    @@ -1654,7 +1741,7 @@
    Parameters
    -
    Headers
    +
    Headers
    @@ -1673,7 +1760,7 @@
    HeadersResponses
    +
    Responses
    @@ -1695,9 +1782,9 @@
    ResponsesExample cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/category/1/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'
    +
     curl --location 'host/api/recipe/category/1/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'
     
    @@ -1705,11 +1792,11 @@

    Create category POST /api/recipe/category/add
    Payload
    -
    recipe.Category object
    {
    -    "name": string
    -}
    +
    recipe.Category object
    {
    +    "name": string
    +}
     
    -
    Headers
    +
    Headers

    @@ -1734,7 +1821,7 @@
    HeadersResponses
    +
    Responses
    @@ -1761,9 +1848,9 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/category/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{"name":"Greek"}'
    +
     curl --location 'host/api/recipe/category/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{"name":"Greek"}'
     
    @@ -1771,12 +1858,12 @@

    Update category PUT /api/recipe/category/int:pk
    Payload
    -
    recipe.Category object
    {
    -    "name": string,
    -
    -}
    +
    recipe.Category object
    {
    +    "name": string,
    +
    +}
     
    -
    Parameters
    +
    Parameters
    @@ -1795,7 +1882,7 @@
    Parameters
    -
    Headers
    +
    Headers
    @@ -1820,7 +1907,7 @@
    HeadersResponses
    +
    Responses
    @@ -1847,9 +1934,9 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location --request PUT 'host/api/recipe/category/6' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{"name":"Italiano"}'
    +
     curl --location --request PUT 'host/api/recipe/category/6' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{"name":"Italiano"}'
     
    @@ -1858,7 +1945,7 @@

    Tag¶<

    Get all tags

    GET /api/recipe/tags -
    Headers
    +
    Headers
    @@ -1877,7 +1964,7 @@
    HeadersResponses
    +
    Responses
    @@ -1899,16 +1986,16 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/tags' --header 'X-Auth-Header: X_AUTH_HEADER'
    +
     curl --location 'host/api/recipe/tags' --header 'X-Auth-Header: X_AUTH_HEADER'
     

    Get all recipes from tag

    GET /api/recipe/tag/int:pk/recipes -
    Parameters
    +
    Parameters
    @@ -1927,7 +2014,7 @@
    Parameters
    -
    Headers
    +
    Headers
    @@ -1946,7 +2033,7 @@
    HeadersResponses
    +
    Responses
    @@ -1968,9 +2055,9 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/tag/<int:pk>/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'
    +
     curl --location 'host/api/recipe/tag/<int:pk>/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'
     
    @@ -1978,11 +2065,11 @@

    Create tag POST /api/recipe/tag/add
    Payload
    -
    recipe.Tag object
    {
    -    "name": string
    -}
    +
    recipe.Tag object
    {
    +    "name": string
    +}
     
    -
    Headers
    +
    Headers
    @@ -2007,7 +2094,7 @@
    HeadersResponses
    +
    Responses
    @@ -2034,9 +2121,9 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/tag/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{"name":"Summer vibes"}'
    +
     curl --location 'host/api/recipe/tag/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{"name":"Summer vibes"}'
     
    @@ -2044,12 +2131,12 @@

    Update tag PUT /api/recipe/tag/int:pk
    Payload
    -
    recipe.Category object
    {
    -    "name": string,
    -
    -}
    +
    recipe.Category object
    {
    +    "name": string,
    +
    +}
     
    -
    Parameters
    +
    Parameters
    @@ -2068,7 +2155,7 @@
    Parameters
    -
    Headers
    +
    Headers
    @@ -2093,7 +2180,7 @@
    HeadersResponses
    +
    Responses
    @@ -2120,9 +2207,9 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location --request PUT 'host/api/recipe/tag/1' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{"name":"Summer Vibes"}'
    +
     curl --location --request PUT 'host/api/recipe/tag/1' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{"name":"Summer Vibes"}'
     
    @@ -2130,22 +2217,26 @@
    Example cURLIngredients
    POST /api/recipe/int:pk/ingredients +
    +Info +

    Override already existing ingredients for the recipe

    +
    Payload
    -
    recipe.Igredient object list
    [
    -    {
    -        "name": "string,
    -        "quantity": string,
    -        "metric": "string
    -    },
    -    {
    -        "name": "string,
    -        "quantity": string,
    -        "metric": "string
    -    },
    -....
    -]
    +
    recipe.Igredient object list
    [
    +    {
    +        "name": "string,
    +        "quantity": string,
    +        "metric": "string
    +    },
    +    {
    +        "name": "string,
    +        "quantity": string,
    +        "metric": "string
    +    },
    +....
    +]
     
    -
    Parameters
    +
    Parameters
    @@ -2164,7 +2255,7 @@
    Parameters
    -
    Headers
    +
    Headers
    @@ -2189,7 +2280,7 @@
    HeadersResponses
    +
    Responses
    @@ -2216,9 +2307,9 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{"name":"Kasher salt","quantity":"1/5","metric":"tbsp","recipe":24}]'
    +
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{"name":"Kasher salt","quantity":"1/5","metric":"tbsp","recipe":24}]'
     
    @@ -2226,18 +2317,22 @@
    Example cURLSteps
    POST /api/recipe/int:pk/steps +
    +Info +

    Override already existing steps for the recipe

    +
    Payload
    -
    recipe.Step object list
    [
    -    {
    -        "text": string
    -    },
    -    {
    -        "text": string
    -    },
    -....
    -]
    +
    recipe.Step object list
    [
    +    {
    +        "text": string
    +    },
    +    {
    +        "text": string
    +    },
    +....
    +]
     
    -
    Parameters
    +
    Parameters
    @@ -2256,7 +2351,7 @@
    Parameters
    -
    Headers
    +
    Headers
    @@ -2281,7 +2376,7 @@
    HeadersResponses
    +
    Responses
    @@ -2308,9 +2403,9 @@
    Responses
    -
    Example cURL
    +
    Example cURL
    -
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{"text":"Heat the oven","recipe":1}]'
    +
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{"text":"Heat the oven","recipe":1}]'
     
    diff --git a/search/search_index.json b/search/search_index.json index 76e606c..0bad150 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"ForkAPI","text":""},{"location":"#a-lightweight-restapi-client-that-manage-food-recipies-easily","title":"A lightweight RestAPI client that manage food recipies easily","text":"

    ForkAPI is a Django drf based project which can be easily integrated as a backend service for a mobile application or web application that can display, add, favorite a food recipies. The api is designed to be simple to use with build in Dashboard panel to add recipies manual or using the provided endpoints (views in Django).

    You can benefit for future support of the project.

    Get Started Installation

    "},{"location":"Installation/","title":"Installation","text":"

    To install the API you need a Python 3.x installed also venv module and pip. Here will be covered two types of installation for debugging and for production.

    "},{"location":"Installation/#mutual-steps","title":"Mutual Steps","text":"

    Clone the repository with the command

    $ git clone https://github.com/mikebgrep/forkapi\n
    Rename .env.example to .env In linux
    $ cd forkapi\n$ mv .env.example .env \n
    Enter the environment variables in .env file.

    • PAGINATION_PAGE_SIZE is used for pagination used in the API certain endpoint.
    • DJANGO_SECRET you can generate the secret online -> link or with the following command if you have installed django on the machine
      $ python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'\n
    • X_AUTH_HEADER also you can generate random UUID online that will be used for authentication for the read only endpoint. Example header 261ec18d-0e81-4073-8d9e-b34a7a1e5e06 (Don`t use it this is for demo purpose)
    "},{"location":"Installation/#installing-locally-debug-mode","title":"Installing locally (Debug mode)","text":"

    You can create a virtual environment and click of the API. Note replace the 3.x with actual Python version

    $ python3.x -m venv .venv && source .venv/bin/activate\n$ pip install -r requirements.txt\n

    Make the needed migrations so Django can create sqlite database file with tables.

    $ cd forkapi\n$ python manage.py makemigrations authentication\n$ python manage.py makemigrations recipe\n$ python manage.py migrate\n

    At this point everything should be ok, and you can start the server.

    $ python manage.py runserver\n
    You can access the dashboard admin panel on localhost:8000. In this mode you can use it locally if in debug mode which you can change in /forkapi/settings.py file line 27

    "},{"location":"Installation/#installing-in-docker-container-production","title":"Installing in Docker container (Production)","text":"

    To installing in Docker container follow the steps bellow. For Raspberry Pi with Raspbian OS make sure to uncomment the packages in the main Dockerfile on line 16

    • First steps is setting up the fullchain.pem and privkey.pem files needed for the ssl settings in nginx used as reverse proxy.
    • After you obtain ssl certificates for your domain you need to copy them in the nginx/ssl folder.
    • Replace the localhost value for server_name on lines 8 and 14 with your actual domain name in the forkapi/forkapi.nginx.conf configuration file.
    • That all you need to run the docker compose command and the API will be deployed on the server instance or locally on your machine.

      Depends of the available package\n\n$ docker compose up\n\nor \n\n$ docker-compose up\n

    • Access the admin dashboard at your-domain:80 or your-domain:443

    Info

    I will not include steps for setting the domain name servers on this as you can follow the official documentation on your server or the Raspberry Pi documentation.

    Follow next step to check how you can and must made your first request.

    "},{"location":"contribution/","title":"Contribution","text":"

    Any contribution is welcomed and here the instructions to do so:

    1. Fork the repository
    2. Work on master branch if the changes are not major or create a new branch for major updates
    3. Make your changes
    4. Add additional test cases if the change is not covered (recommended)
    5. Run tests with command > tox from the root folder where the tox.ini files is located
    6. Open Pull request
    7. Grab a coffe or a tea \u2027\u208a\u02da \u22c5 \u2615\ufe0f\ud83c\udf75 \u2027\u208a\u02da \u22c5 and relax \ud83d\ude0c

    Info

    For major futures you can open a issue first and then branch that should be named future/name-of-the-change

    "},{"location":"contribution/#desired-modifications","title":"Desired modifications","text":"

    Note

    If you decide to contribute and you have experience with Django a good starting point will be to rework the Django Admin Panel with more fancy look and feel.

    "},{"location":"first-request/","title":"Make your first request","text":"

    After the API is deployed you need to create a superuser for the admin dashboard. This can be done ether with Django manage.py python manage.py createsuperuser command or using an API Client as Postman or curl CLI tool.

    I will present the method with the curl as more convenient method but you can use and Postman.

    "},{"location":"first-request/#creating-superuser","title":"Creating superuser","text":"

    To create a superuser for login into the Admin Dashboard use the following curl command in you terminal or powershell.

    curl --location --request POST --header \"Content-type: application/json\" --header \"X-Auth-Header: X_AUTH_HEADER\"  --data-raw '{\"username\":\"your-username\",\"password\":\"you-password\", \"is_superuser\": true}' 'https://your-domain-name/api/auth/signup'\n
    Take a note that you need to change

    • X_AUTH_HEADER with the value from .env file
    • your-username and your-password with valid data
    • https://your-domain-name with actual domain name

    When you execute the curl command the admin user will be created you can log in to the admin dashboard from the base url of the api (the domain name).

    "},{"location":"rest-references/","title":"Rest Reference","text":""},{"location":"rest-references/#restapi-reference","title":"RestAPI reference","text":""},{"location":"rest-references/#on-this-page-you-can-check-the-restapi-endpoints","title":"On this page you can check the RestAPI endpoints.","text":"

    Note

    The API has build in csrf protection you may need to attach Cookie with value csrftoken=token to work proparly

    "},{"location":"rest-references/#authentication","title":"Authentication","text":""},{"location":"rest-references/#create-admin-user","title":"Create admin user","text":"POST /api/auth/signup"},{"location":"rest-references/#payload","title":"Payload","text":"authentication.UserSerializer
    {\n    \"username\": \"username\",\n    \"password\": \"password\",\n    \"is_superuser\": true\n}\n
    "},{"location":"rest-references/#headers","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses","title":"Responses","text":"http code content-type response 201 application/json User created successfully 400 application/json {\"username\":[\"user with this username already exists.\"]}"},{"location":"rest-references/#example-curl","title":"Example cURL","text":"
     curl --location 'host/api/auth/signup' --header 'X-Auth-Header: X_AUTH_HEADER' --header 'Content-Type: application/json' --data '{\"username\":\"username\",\"password\":\"password\",\"is_superuser\":true}'\n
    "},{"location":"rest-references/#obtain-access-token","title":"Obtain access token","text":"POST /api/auth/token"},{"location":"rest-references/#payload_1","title":"Payload","text":"authentication.UserSerializer
    {\n    \"username\": \"username\",\n    \"password\": \"password\"\n}\n
    "},{"location":"rest-references/#headers_1","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_1","title":"Responses","text":"http code content-type response 200 application/json {\"token\":\"token\",\"user\":{\"username\":\"username\",\"is_superuser\":true}} 404 application/json {\"detail\":\"No User matches the given query.\"} 403 application/json {\"detail\": \"You must use authentication header\"}"},{"location":"rest-references/#example-curl_1","title":"Example cURL","text":"
     `curl --location 'host/api/auth/token' --header 'X-Auth-Header: X_AUTH_HEADER' --header 'Content-Type: application/json' --data '{\"username\":\"username\",\"password\":\"password\"}''\n
    "},{"location":"rest-references/#recipe","title":"Recipe","text":""},{"location":"rest-references/#search-for-recipes","title":"Search for recipes","text":"GET /api/recipe/home/"},{"location":"rest-references/#parameters","title":"Parameters","text":"name type data type description search query (optional) string Part or fulll name of the recipe.Recipe object page query (optional) int Page number if there a mutilple pages result"},{"location":"rest-references/#headers_2","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_2","title":"Responses","text":"http code content-type response 200 application/json {\"count\":int,\"next\":string,\"previous\":string,\"results\":[recipe.Recipe obj list]} 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_2","title":"Example cURL","text":"
     curl --location 'http://host:port/api/recipe/home/?name=name&page=1' --header 'X-Auth-Header: X_AUTH_HEADER\n
    "},{"location":"rest-references/#get-favorite-recipes","title":"Get favorite recipes","text":"GET /api/recipe/home/favorites/"},{"location":"rest-references/#headers_3","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_3","title":"Responses","text":"http code content-type response 200 application/json {\"count\":int,\"next\":string,\"previous\":string,\"results\":[recipe.Recipe obj list]} 404 application/json {\"detail\":\"No Recipe matches the given query.\"} 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_3","title":"Example cURL","text":"
     curl --location 'http://host:port/api/recipe/home/favorites/' --header 'X-Auth-Header: X_AUTH_HEADER\n
    "},{"location":"rest-references/#get-trending-recipes","title":"Get trending recipes","text":"GET /api/recipe/trending"},{"location":"rest-references/#headers_4","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_4","title":"Responses","text":"http code content-type response 200 application/json [recipe.Recipe objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_4","title":"Example cURL","text":"
     curl --location 'localhost:8080/api/recipe/trending' --header 'X-Auth-Header: X_AUTH_HEADER\n
    "},{"location":"rest-references/#update-favorite-status","title":"Update favorite status","text":"PATCH /api/recipe/int:pk/favorite"},{"location":"rest-references/#parameters_1","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to be favorited or unfavorited"},{"location":"rest-references/#headers_5","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\""},{"location":"rest-references/#responses_5","title":"Responses","text":"http code content-type response 201 application/json \"Success favorite recipe\" 201 application/json \"Success unfavorite recipe\" 403 application/json `{\"detail\":\"You must use authentication header\"} 404 application/json Not Found"},{"location":"rest-references/#example-curl_5","title":"Example cURL","text":"
     curl --location --request PATCH 'host/api/recipe/1/favorite' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#create-recipe","title":"Create recipe","text":"POST /api/recipe/"},{"location":"rest-references/#payload_2","title":"Payload","text":"recipe.Recipe object
    {\n    \"image\": file,\n    \"name\": string,\n    \"serves\": int,\n    \"video\": file (optional),\n    \"category\": <int:pk>,\n    \"tag\": <int:pk>,\n    \"prep_time\": int,\n}\n
    "},{"location":"rest-references/#headers_6","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type multipart/form-data Recipe object Recipe multipart/form-data object"},{"location":"rest-references/#responses_6","title":"Responses","text":"http code content-type response 201 application/json {recipe.Recipe object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_6","title":"Example cURL","text":"
     curl --location 'localhost:8080/api/recipe/'  --header 'Authorization: Token d8916a5f6cf16d2c6a87bc7461bc4680245609f0' --form 'image=@\"/path/image.jpg\"' --form 'name=\"Test recipe creation\"' --form 'serves=\"5\"' --form 'category=\"1\"' --form 'tag=1' --form 'prep_time=\"45\"'\n
    "},{"location":"rest-references/#update-recipe-main-info-without-ingredients-and-steps","title":"Update recipe main info (without ingredients and steps)","text":"PUT /api/recipe/int:pk"},{"location":"rest-references/#payload_3","title":"Payload","text":"recipe.Recipe object
    {\n    \"image\": file,\n    \"name\": string,\n    \"serves\": int,\n    \"video\": file (optional),\n    \"category\": <int:pk>,\n    \"tag\": <int:pk>,\n    \"prep_time\": int,\n}\n
    "},{"location":"rest-references/#parameters_2","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to be updated"},{"location":"rest-references/#headers_7","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type multipart/form-data Recipe object Recipe multipart/form-data object"},{"location":"rest-references/#responses_7","title":"Responses","text":"http code content-type response 200 application/json {recipe.Recipe object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_7","title":"Example cURL","text":"
     curl --location --request PUT 'host/api/recipe/1' --header 'Authorization: Token d8916a5f6cf16d2c6a87bc7461bc4680245609f0' --form 'image=@\"/path/image.jpg\"' --form 'name=\"Update name\"' --form 'serves=\"4\"' --form 'category=\"1\"' --form 'tag=\"1\"' --form 'prep_time=\"21\"'\n
    "},{"location":"rest-references/#category","title":"Category","text":""},{"location":"rest-references/#get-all-categories","title":"Get all categories","text":"GET /api/recipe/trending"},{"location":"rest-references/#headers_8","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_8","title":"Responses","text":"http code content-type response 200 application/json [recipe.Category objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_8","title":"Example cURL","text":"
     curl --location 'host/api/recipe/category' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#get-all-categories-recipes","title":"Get all categories recipes","text":"GET /api/recipe/category/int:pk/recipes"},{"location":"rest-references/#parameters_3","title":"Parameters","text":"name type data type description <int:pk> path (required) int Category primary key"},{"location":"rest-references/#headers_9","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_9","title":"Responses","text":"http code content-type response 200 application/json [recipe.Recipe objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_9","title":"Example cURL","text":"
     curl --location 'host/api/recipe/category/1/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#create-category","title":"Create category","text":"POST /api/recipe/category/add"},{"location":"rest-references/#payload_4","title":"Payload","text":"recipe.Category object
    {\n    \"name\": string\n}\n
    "},{"location":"rest-references/#headers_10","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_10","title":"Responses","text":"http code content-type response 201 application/json {recipe.Category object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_10","title":"Example cURL","text":"
     curl --location 'host/api/recipe/category/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{\"name\":\"Greek\"}'\n
    "},{"location":"rest-references/#update-category","title":"Update category","text":"PUT /api/recipe/category/int:pk"},{"location":"rest-references/#payload_5","title":"Payload","text":"recipe.Category object
    {\n    \"name\": string,\n\n}\n
    "},{"location":"rest-references/#parameters_4","title":"Parameters","text":"name type data type description <int:pk> path (required) int Category primary key"},{"location":"rest-references/#headers_11","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_11","title":"Responses","text":"http code content-type response 200 application/json {recipe.Recipe object} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"} 404 application/json {\"detail\":\"No Category matches the given query.\"}"},{"location":"rest-references/#example-curl_11","title":"Example cURL","text":"
     curl --location --request PUT 'host/api/recipe/category/6' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{\"name\":\"Italiano\"}'\n
    "},{"location":"rest-references/#tag","title":"Tag","text":""},{"location":"rest-references/#get-all-tags","title":"Get all tags","text":"GET /api/recipe/tags"},{"location":"rest-references/#headers_12","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_12","title":"Responses","text":"http code content-type response 200 application/json [recipe.Tag objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_12","title":"Example cURL","text":"
     curl --location 'host/api/recipe/tags' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#get-all-recipes-from-tag","title":"Get all recipes from tag","text":"GET /api/recipe/tag/int:pk/recipes"},{"location":"rest-references/#parameters_5","title":"Parameters","text":"name type data type description <int:pk> path (required) int Tag primary key"},{"location":"rest-references/#headers_13","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_13","title":"Responses","text":"http code content-type response 200 application/json {\"count\":int,\"next\":string,\"previous\":string,\"results\":[recipe.Recipe obj list]} 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_13","title":"Example cURL","text":"
     curl --location 'host/api/recipe/tag/<int:pk>/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#create-tag","title":"Create tag","text":"POST /api/recipe/tag/add"},{"location":"rest-references/#payload_6","title":"Payload","text":"recipe.Tag object
    {\n    \"name\": string\n}\n
    "},{"location":"rest-references/#headers_14","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_14","title":"Responses","text":"http code content-type response 201 application/json {recipe.Category object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_14","title":"Example cURL","text":"
     curl --location 'host/api/recipe/tag/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{\"name\":\"Summer vibes\"}'\n
    "},{"location":"rest-references/#update-tag","title":"Update tag","text":"PUT /api/recipe/tag/int:pk"},{"location":"rest-references/#payload_7","title":"Payload","text":"recipe.Category object
    {\n    \"name\": string,\n\n}\n
    "},{"location":"rest-references/#parameters_6","title":"Parameters","text":"name type data type description <int:pk> path (required) int Tag primary key"},{"location":"rest-references/#headers_15","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_15","title":"Responses","text":"http code content-type response 200 application/json {recipe.Tag object} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"} 404 application/json {\"detail\":\"No Category matches the given query.\"}"},{"location":"rest-references/#example-curl_15","title":"Example cURL","text":"
     curl --location --request PUT 'host/api/recipe/tag/1' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{\"name\":\"Summer Vibes\"}'\n
    "},{"location":"rest-references/#ingredients","title":"Ingredients","text":"POST /api/recipe/int:pk/ingredients"},{"location":"rest-references/#payload_8","title":"Payload","text":"recipe.Igredient object list
    [\n    {\n        \"name\": \"string,\n        \"quantity\": string,\n        \"metric\": \"string\n    },\n    {\n        \"name\": \"string,\n        \"quantity\": string,\n        \"metric\": \"string\n    },\n....\n]\n
    "},{"location":"rest-references/#parameters_7","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to which to link the ingredients"},{"location":"rest-references/#headers_16","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_16","title":"Responses","text":"http code content-type response 201 application/json [{recipe.Ingrediant object}] 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_16","title":"Example cURL","text":"
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{\"name\":\"Kasher salt\",\"quantity\":\"1/5\",\"metric\":\"tbsp\",\"recipe\":24}]'\n
    "},{"location":"rest-references/#steps","title":"Steps","text":"POST /api/recipe/int:pk/steps"},{"location":"rest-references/#payload_9","title":"Payload","text":"recipe.Step object list
    [\n    {\n        \"text\": string\n    },\n    {\n        \"text\": string\n    },\n....\n]\n
    "},{"location":"rest-references/#parameters_8","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to which to link the steps"},{"location":"rest-references/#headers_17","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_17","title":"Responses","text":"http code content-type response 201 application/json [{recipe.Step object}] 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_17","title":"Example cURL","text":"
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{\"text\":\"Heat the oven\",\"recipe\":1}]'\n
    "},{"location":"user-guide/","title":"User Guide","text":"

    The documentation for ForkAPI contains number of sections that are listed bellow.

    • Installation
    • Make your first request
    • Rest documentation
    • Contribution
    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"ForkAPI","text":""},{"location":"#a-lightweight-restapi-client-that-manage-food-recipies-easily","title":"A lightweight RestAPI client that manage food recipies easily","text":"

    ForkAPI is a Django drf based project which can be easily integrated as a backend service for a mobile application or web application that can display, add, favorite a food recipies. The api is designed to be simple to use with build in Dashboard panel to add recipies manual or using the provided endpoints (views in Django).

    You can benefit for future support of the project.

    Get Started Installation

    "},{"location":"Installation/","title":"Installation","text":"

    To install the API you need a Python 3.x installed also venv module and pip. Here will be covered two types of installation for debugging and for production.

    "},{"location":"Installation/#mutual-steps","title":"Mutual Steps","text":"

    Clone the repository with the command

    $ git clone https://github.com/mikebgrep/forkapi\n
    Rename .env.example to .env In linux
    $ cd forkapi\n$ mv .env.example .env \n
    Enter the environment variables in .env file.

    • PAGINATION_PAGE_SIZE is used for pagination used in the API certain endpoint.
    • DJANGO_SECRET you can generate the secret online -> link or with the following command if you have installed django on the machine
      $ python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'\n
    • X_AUTH_HEADER also you can generate random UUID online that will be used for authentication for the read only endpoint. Example header 261ec18d-0e81-4073-8d9e-b34a7a1e5e06 (Don`t use it this is for demo purpose)
    "},{"location":"Installation/#installing-locally-debug-mode","title":"Installing locally (Debug mode)","text":"

    You can create a virtual environment and click of the API. Note replace the 3.x with actual Python version

    $ python3.x -m venv .venv && source .venv/bin/activate\n$ pip install -r requirements.txt\n

    Make the needed migrations so Django can create sqlite database file with tables.

    $ cd forkapi\n$ python manage.py makemigrations authentication\n$ python manage.py makemigrations recipe\n$ python manage.py migrate\n

    At this point everything should be ok, and you can start the server.

    $ python manage.py runserver\n
    You can access the dashboard admin panel on localhost:8000. In this mode you can use it locally if in debug mode which you can change in /forkapi/settings.py file line 27

    "},{"location":"Installation/#installing-in-docker-container-production","title":"Installing in Docker container (Production)","text":"

    To installing in Docker container follow the steps bellow. For Raspberry Pi with Raspbian OS make sure to uncomment the packages in the main Dockerfile on line 16

    • First steps is setting up the fullchain.pem and privkey.pem files needed for the ssl settings in nginx used as reverse proxy.
    • After you obtain ssl certificates for your domain you need to copy them in the nginx/ssl folder.
    • Replace the localhost value for server_name on lines 8 and 14 with your actual domain name in the forkapi/forkapi.nginx.conf configuration file.
    • That all you need to run the docker compose command and the API will be deployed on the server instance or locally on your machine.

      Depends of the available package\n\n$ docker compose up\n\nor \n\n$ docker-compose up\n

    • Access the admin dashboard at your-domain:80 or your-domain:443

    Info

    I will not include steps for setting the domain name servers on this as you can follow the official documentation on your server or the Raspberry Pi documentation.

    Follow next step to check how you can and must made your first request.

    "},{"location":"contribution/","title":"Contribution","text":"

    Any contribution is welcomed and here the instructions to do so:

    1. Fork the repository
    2. Work on master branch if the changes are not major or create a new branch for major updates
    3. Make your changes
    4. Add additional test cases if the change is not covered (recommended)
    5. Run tests with command > tox from the root folder where the tox.ini files is located
    6. Open Pull request
    7. Grab a coffe or a tea \u2027\u208a\u02da \u22c5 \u2615\ufe0f\ud83c\udf75 \u2027\u208a\u02da \u22c5 and relax \ud83d\ude0c

    Info

    For major futures you can open a issue first and then branch that should be named future/name-of-the-change

    "},{"location":"contribution/#desired-modifications","title":"Desired modifications","text":"

    Note

    If you decide to contribute and you have experience with Django a good starting point will be to rework the Django Admin Panel with more fancy look and feel.

    "},{"location":"first-request/","title":"Make your first request","text":"

    After the API is deployed you need to create a superuser for the admin dashboard. This can be done ether with Django manage.py python manage.py createsuperuser command or using an API Client as Postman or curl CLI tool.

    I will present the method with the curl as more convenient method but you can use and Postman.

    "},{"location":"first-request/#creating-superuser","title":"Creating superuser","text":"

    To create a superuser for login into the Admin Dashboard use the following curl command in you terminal or powershell.

    curl --location --request POST --header \"Content-type: application/json\" --header \"X-Auth-Header: X_AUTH_HEADER\"  --data-raw '{\"username\":\"your-username\",\"password\":\"you-password\", \"is_superuser\": true}' 'https://your-domain-name/api/auth/signup'\n
    Take a note that you need to change

    • X_AUTH_HEADER with the value from .env file
    • your-username and your-password with valid data
    • https://your-domain-name with actual domain name

    When you execute the curl command the admin user will be created you can log in to the admin dashboard from the base url of the api (the domain name).

    "},{"location":"rest-references/","title":"Rest Reference","text":""},{"location":"rest-references/#restapi-reference","title":"RestAPI reference","text":""},{"location":"rest-references/#on-this-page-you-can-check-the-restapi-endpoints","title":"On this page you can check the RestAPI endpoints.","text":"

    Note

    The API has build in csrf protection you may need to attach Cookie with value csrftoken=token to work proparly

    "},{"location":"rest-references/#authentication","title":"Authentication","text":""},{"location":"rest-references/#create-admin-user","title":"Create admin user","text":"POST /api/auth/signup"},{"location":"rest-references/#payload","title":"Payload","text":"authentication.UserSerializer
    {\n    \"username\": \"username\",\n    \"password\": \"password\",\n    \"is_superuser\": true\n}\n
    "},{"location":"rest-references/#headers","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses","title":"Responses","text":"http code content-type response 201 application/json User created successfully 400 application/json {\"username\":[\"user with this username already exists.\"]}"},{"location":"rest-references/#example-curl","title":"Example cURL","text":"
     curl --location 'host/api/auth/signup' --header 'X-Auth-Header: X_AUTH_HEADER' --header 'Content-Type: application/json' --data '{\"username\":\"username\",\"password\":\"password\",\"is_superuser\":true}'\n
    "},{"location":"rest-references/#obtain-access-token","title":"Obtain access token","text":"POST /api/auth/token"},{"location":"rest-references/#payload_1","title":"Payload","text":"authentication.UserSerializer
    {\n    \"username\": \"username\",\n    \"password\": \"password\"\n}\n
    "},{"location":"rest-references/#headers_1","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_1","title":"Responses","text":"http code content-type response 200 application/json {\"token\":\"token\",\"user\":{\"username\":\"username\",\"is_superuser\":true}} 404 application/json {\"detail\":\"No User matches the given query.\"} 403 application/json {\"detail\": \"You must use authentication header\"}"},{"location":"rest-references/#example-curl_1","title":"Example cURL","text":"
     `curl --location 'host/api/auth/token' --header 'X-Auth-Header: X_AUTH_HEADER' --header 'Content-Type: application/json' --data '{\"username\":\"username\",\"password\":\"password\"}''\n
    "},{"location":"rest-references/#recipe","title":"Recipe","text":""},{"location":"rest-references/#search-for-recipes","title":"Search for recipes","text":"GET /api/recipe/home/"},{"location":"rest-references/#parameters","title":"Parameters","text":"name type data type description search query (optional) string Part or fulll name of the recipe.Recipe object page query (optional) int Page number if there a mutilple pages result"},{"location":"rest-references/#headers_2","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_2","title":"Responses","text":"http code content-type response 200 application/json {\"count\":int,\"next\":string,\"previous\":string,\"results\":[recipe.Recipe obj list]} 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_2","title":"Example cURL","text":"
     curl --location 'http://host:port/api/recipe/home/?name=name&page=1' --header 'X-Auth-Header: X_AUTH_HEADER\n
    "},{"location":"rest-references/#get-favorite-recipes","title":"Get favorite recipes","text":"GET /api/recipe/home/favorites/"},{"location":"rest-references/#headers_3","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_3","title":"Responses","text":"http code content-type response 200 application/json {\"count\":int,\"next\":string,\"previous\":string,\"results\":[recipe.Recipe obj list]} 404 application/json {\"detail\":\"No Recipe matches the given query.\"} 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_3","title":"Example cURL","text":"
     curl --location 'http://host:port/api/recipe/home/favorites/' --header 'X-Auth-Header: X_AUTH_HEADER\n
    "},{"location":"rest-references/#get-trending-recipes","title":"Get trending recipes","text":"GET /api/recipe/trending"},{"location":"rest-references/#headers_4","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_4","title":"Responses","text":"http code content-type response 200 application/json [recipe.Recipe objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_4","title":"Example cURL","text":"
     curl --location 'localhost:8080/api/recipe/trending' --header 'X-Auth-Header: X_AUTH_HEADER\n
    "},{"location":"rest-references/#update-favorite-status","title":"Update favorite status","text":"PATCH /api/recipe/int:pk/favorite"},{"location":"rest-references/#parameters_1","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to be favorited or unfavorited"},{"location":"rest-references/#headers_5","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\""},{"location":"rest-references/#responses_5","title":"Responses","text":"http code content-type response 201 application/json \"Success favorite recipe\" 201 application/json \"Success unfavorite recipe\" 403 application/json `{\"detail\":\"You must use authentication header\"} 404 application/json Not Found"},{"location":"rest-references/#example-curl_5","title":"Example cURL","text":"
     curl --location --request PATCH 'host/api/recipe/1/favorite' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#create-recipe","title":"Create recipe","text":"POST /api/recipe/"},{"location":"rest-references/#payload_2","title":"Payload","text":"recipe.Recipe object
    {\n    \"image\": file,\n    \"name\": string,\n    \"serves\": int,\n    \"video\": file (optional),\n    \"category\": <int:pk>,\n    \"tag\": <int:pk>,\n    \"prep_time\": int,\n}\n
    "},{"location":"rest-references/#headers_6","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type multipart/form-data Recipe object Recipe multipart/form-data object"},{"location":"rest-references/#responses_6","title":"Responses","text":"http code content-type response 201 application/json {recipe.Recipe object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_6","title":"Example cURL","text":"
     curl --location 'localhost:8080/api/recipe/'  --header 'Authorization: Token d8916a5f6cf16d2c6a87bc7461bc4680245609f0' --form 'image=@\"/path/image.jpg\"' --form 'name=\"Test recipe creation\"' --form 'serves=\"5\"' --form 'category=\"1\"' --form 'tag=1' --form 'prep_time=\"45\"'\n
    "},{"location":"rest-references/#update-recipe-main-info-without-ingredients-and-steps","title":"Update recipe main info (without ingredients and steps)","text":"PUT /api/recipe/int:pk"},{"location":"rest-references/#payload_3","title":"Payload","text":"recipe.Recipe object
    {\n    \"image\": file,\n    \"name\": string,\n    \"serves\": int,\n    \"video\": file (optional),\n    \"category\": <int:pk>,\n    \"tag\": <int:pk>,\n    \"prep_time\": int,\n}\n
    "},{"location":"rest-references/#parameters_2","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to be updated"},{"location":"rest-references/#headers_7","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type multipart/form-data Recipe object Recipe multipart/form-data object"},{"location":"rest-references/#responses_7","title":"Responses","text":"http code content-type response 200 application/json {recipe.Recipe object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_7","title":"Example cURL","text":"
     curl --location --request PUT 'host/api/recipe/1' --header 'Authorization: Token d8916a5f6cf16d2c6a87bc7461bc4680245609f0' --form 'image=@\"/path/image.jpg\"' --form 'name=\"Update name\"' --form 'serves=\"4\"' --form 'category=\"1\"' --form 'tag=\"1\"' --form 'prep_time=\"21\"'\n
    "},{"location":"rest-references/#delete-recipes","title":"Delete recipes","text":"DELETE /api/recipe/pk:int/"},{"location":"rest-references/#parameters_3","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to be deleted"},{"location":"rest-references/#headers_8","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\""},{"location":"rest-references/#responses_8","title":"Responses","text":"http code content-type response 204 application/json 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_8","title":"Example cURL","text":"
     curl --location --request DELETE 'host/api/recipe/<int:pk>/' --header 'Authorization: Token d8916a5f6cf16d2c6a87bc7461bc4680245609f0' \n
    "},{"location":"rest-references/#category","title":"Category","text":""},{"location":"rest-references/#get-all-categories","title":"Get all categories","text":"GET /api/recipe/trending"},{"location":"rest-references/#headers_9","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_9","title":"Responses","text":"http code content-type response 200 application/json [recipe.Category objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_9","title":"Example cURL","text":"
     curl --location 'host/api/recipe/category' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#get-all-categories-recipes","title":"Get all categories recipes","text":"GET /api/recipe/category/int:pk/recipes"},{"location":"rest-references/#parameters_4","title":"Parameters","text":"name type data type description <int:pk> path (required) int Category primary key"},{"location":"rest-references/#headers_10","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_10","title":"Responses","text":"http code content-type response 200 application/json [recipe.Recipe objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_10","title":"Example cURL","text":"
     curl --location 'host/api/recipe/category/1/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#create-category","title":"Create category","text":"POST /api/recipe/category/add"},{"location":"rest-references/#payload_4","title":"Payload","text":"recipe.Category object
    {\n    \"name\": string\n}\n
    "},{"location":"rest-references/#headers_11","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_11","title":"Responses","text":"http code content-type response 201 application/json {recipe.Category object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_11","title":"Example cURL","text":"
     curl --location 'host/api/recipe/category/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{\"name\":\"Greek\"}'\n
    "},{"location":"rest-references/#update-category","title":"Update category","text":"PUT /api/recipe/category/int:pk"},{"location":"rest-references/#payload_5","title":"Payload","text":"recipe.Category object
    {\n    \"name\": string,\n\n}\n
    "},{"location":"rest-references/#parameters_5","title":"Parameters","text":"name type data type description <int:pk> path (required) int Category primary key"},{"location":"rest-references/#headers_12","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_12","title":"Responses","text":"http code content-type response 200 application/json {recipe.Recipe object} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"} 404 application/json {\"detail\":\"No Category matches the given query.\"}"},{"location":"rest-references/#example-curl_12","title":"Example cURL","text":"
     curl --location --request PUT 'host/api/recipe/category/6' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{\"name\":\"Italiano\"}'\n
    "},{"location":"rest-references/#tag","title":"Tag","text":""},{"location":"rest-references/#get-all-tags","title":"Get all tags","text":"GET /api/recipe/tags"},{"location":"rest-references/#headers_13","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_13","title":"Responses","text":"http code content-type response 200 application/json [recipe.Tag objects list] 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_13","title":"Example cURL","text":"
     curl --location 'host/api/recipe/tags' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#get-all-recipes-from-tag","title":"Get all recipes from tag","text":"GET /api/recipe/tag/int:pk/recipes"},{"location":"rest-references/#parameters_6","title":"Parameters","text":"name type data type description <int:pk> path (required) int Tag primary key"},{"location":"rest-references/#headers_14","title":"Headers","text":"name type data type description X-Auth-Header required UUID Header used for authentication with the API"},{"location":"rest-references/#responses_14","title":"Responses","text":"http code content-type response 200 application/json {\"count\":int,\"next\":string,\"previous\":string,\"results\":[recipe.Recipe obj list]} 403 application/json {\"detail\":\"You must use authentication header\"}"},{"location":"rest-references/#example-curl_14","title":"Example cURL","text":"
     curl --location 'host/api/recipe/tag/<int:pk>/recipes' --header 'X-Auth-Header: X_AUTH_HEADER'\n
    "},{"location":"rest-references/#create-tag","title":"Create tag","text":"POST /api/recipe/tag/add"},{"location":"rest-references/#payload_6","title":"Payload","text":"recipe.Tag object
    {\n    \"name\": string\n}\n
    "},{"location":"rest-references/#headers_15","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_15","title":"Responses","text":"http code content-type response 201 application/json {recipe.Category object} 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_15","title":"Example cURL","text":"
     curl --location 'host/api/recipe/tag/add' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '{\"name\":\"Summer vibes\"}'\n
    "},{"location":"rest-references/#update-tag","title":"Update tag","text":"PUT /api/recipe/tag/int:pk"},{"location":"rest-references/#payload_7","title":"Payload","text":"recipe.Category object
    {\n    \"name\": string,\n\n}\n
    "},{"location":"rest-references/#parameters_7","title":"Parameters","text":"name type data type description <int:pk> path (required) int Tag primary key"},{"location":"rest-references/#headers_16","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_16","title":"Responses","text":"http code content-type response 200 application/json {recipe.Tag object} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"} 404 application/json {\"detail\":\"No Category matches the given query.\"}"},{"location":"rest-references/#example-curl_16","title":"Example cURL","text":"
     curl --location --request PUT 'host/api/recipe/tag/1' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900'  --header 'Content-Type: application/json'  --data '{\"name\":\"Summer Vibes\"}'\n
    "},{"location":"rest-references/#ingredients","title":"Ingredients","text":"POST /api/recipe/int:pk/ingredients Info

    Override already existing ingredients for the recipe

    "},{"location":"rest-references/#payload_8","title":"Payload","text":"recipe.Igredient object list
    [\n    {\n        \"name\": \"string,\n        \"quantity\": string,\n        \"metric\": \"string\n    },\n    {\n        \"name\": \"string,\n        \"quantity\": string,\n        \"metric\": \"string\n    },\n....\n]\n
    "},{"location":"rest-references/#parameters_8","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to which to link the ingredients"},{"location":"rest-references/#headers_17","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_17","title":"Responses","text":"http code content-type response 201 application/json [{recipe.Ingrediant object}] 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_17","title":"Example cURL","text":"
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{\"name\":\"Kasher salt\",\"quantity\":\"1/5\",\"metric\":\"tbsp\",\"recipe\":24}]'\n
    "},{"location":"rest-references/#steps","title":"Steps","text":"POST /api/recipe/int:pk/steps Info

    Override already existing steps for the recipe

    "},{"location":"rest-references/#payload_9","title":"Payload","text":"recipe.Step object list
    [\n    {\n        \"text\": string\n    },\n    {\n        \"text\": string\n    },\n....\n]\n
    "},{"location":"rest-references/#parameters_9","title":"Parameters","text":"name type data type description <int:pk> path (required) int Recipe primary key to which to link the steps"},{"location":"rest-references/#headers_18","title":"Headers","text":"name type data type description Authorization required Access Token Token obtained from login endpoint example \"token 443c104be8c6daeeaf86df634e69b97668b99900\" Content-Type application/json `Applicaton Json content header"},{"location":"rest-references/#responses_18","title":"Responses","text":"http code content-type response 201 application/json [{recipe.Step object}] 400 application/json {\"tag\":[\"Incorrect type. message\"]} 401 application/json {\"detail\":\"Authentication credentials were not provided.\"}"},{"location":"rest-references/#example-curl_18","title":"Example cURL","text":"
     curl --location 'host/api/recipe/ingredients' --header 'Authorization: token 443c104be8c6daeeaf86df634e69b97668b99900' --data '[{\"text\":\"Heat the oven\",\"recipe\":1}]'\n
    "},{"location":"user-guide/","title":"User Guide","text":"

    The documentation for ForkAPI contains number of sections that are listed bellow.

    • Installation
    • Make your first request
    • Rest documentation
    • Contribution
    "}]} \ No newline at end of file diff --git a/stylesheets/extra.css b/stylesheets/extra.css index 443e994..f2c960f 100644 --- a/stylesheets/extra.css +++ b/stylesheets/extra.css @@ -70,4 +70,22 @@ background-color: rgb(0, 176, 255); -webkit-mask-image: var(--md-admonition-icon--pied-piper-put); mask-image: var(--md-admonition-icon--pied-piper-put); +} + +:root { + --md-admonition-icon--pied-piper-delete: url('data:image/svg+xml;charset=utf-8,') +} +.md-typeset .admonition.pied-piper-delete, +.md-typeset details.pied-piper-delete { + border-color: rgb(255, 82, 82); +} +.md-typeset .pied-piper-delete > .admonition-title, +.md-typeset .pied-piper-delete > summary { + background-color: rgba(255, 82, 82, 0.1); +} +.md-typeset .pied-piper-delete > .admonition-title::before, +.md-typeset .pied-piper-delete > summary::before { + background-color: rgb(255, 82, 82); + -webkit-mask-image: var(--md-admonition-icon--pied-piper-delete); + mask-image: var(--md-admonition-icon--pied-piper-delete); } \ No newline at end of file