MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer 1|Token".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token can be obtained by contacting the administrator.

Note

Api for notes management

Get all notes

requires authentication

Retrieves a list of notes with optional filters and includes related user plant data.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/note" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/note"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 21,
            "title": "repellendus",
            "content": "Dolorem cupiditate mollitia consequuntur totam.",
            "status": "aktywna",
            "categories": "Wydarzenia",
            "priority": 623699120,
            "photo_path": null,
            "user_plant_id": 2
        },
        {
            "id": 22,
            "title": "minima",
            "content": "Et quas laborum quis quis ea repellat assumenda cumque.",
            "status": "ważna",
            "categories": "Środowisko",
            "priority": 1867508646,
            "photo_path": null,
            "user_plant_id": 20
        }
    ]
}
 

Request      

GET api/v1/note

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

includeUserPlants   boolean  optional  

optional Include associated user plants in the response.

title[eq]   string  optional  

optional Filter notes by exact title.

content[eq]   string  optional  

optional Filter notes by exact content.

status[eq]   string  optional  

optional Filter notes by exact status.

categories[eq]   string  optional  

optional Filter notes by exact categories.

priority[eq]   integer  optional  

optional Filter notes by exact priority.

priority[lt]   integer  optional  

optional Filter notes by priority less than.

priority[gt]   integer  optional  

optional Filter notes by priority greater than.

photo_path[eq]   string  optional  

optional Filter notes by exact photo path.

user_plant_id[eq]   integer  optional  

optional Filter notes by exact user plant ID.

Create a new note

requires authentication

Stores a new note record in the database based on the provided information.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/note" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"title\": \"bngqxwzmwfozkefgvxba\",
    \"content\": \"suegneafkxndfvxvwkht\",
    \"status\": \"tmkgnpexgudhssdhuwixniwiw\",
    \"categories\": \"Podlewanie\",
    \"priority\": 5,
    \"photo_path\": \"jfvucovdgowaanljkcquvesl\",
    \"user_plant_id\": 20
}"
const url = new URL(
    "https://leaflly.pl/api/v1/note"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "title": "bngqxwzmwfozkefgvxba",
    "content": "suegneafkxndfvxvwkht",
    "status": "tmkgnpexgudhssdhuwixniwiw",
    "categories": "Podlewanie",
    "priority": 5,
    "photo_path": "jfvucovdgowaanljkcquvesl",
    "user_plant_id": 20
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/note

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

title   string   

Must not be greater than 255 characters. Example: bngqxwzmwfozkefgvxba

content   string  optional  

Must not be greater than 255 characters. Example: suegneafkxndfvxvwkht

status   string   

Must not be greater than 56 characters. Example: tmkgnpexgudhssdhuwixniwiw

Must be one of:
  • aktywna
  • archiwalne
  • ważna
  • inna
categories   string  optional  

Example: Podlewanie

Must be one of:
  • Problemy i Choroby
  • Podlewanie
  • Nawożenie
  • Inspiracje i pomysły
  • Plan pielęgnacji
  • Przycinanie
  • Historia rośliny
  • Środowisko
  • Lista zakupów
  • Wydarzenia
  • Inna
priority   integer   

Example: 5

photo_path   string  optional  

Must not be greater than 255 characters. Example: jfvucovdgowaanljkcquvesl

user_plant_id   integer   

Example: 20

Show a note

requires authentication

Retrieves detailed information about a specific note. Optionally includes related user plant data.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/note/1?includeUserPlant=1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/note/1"
);

const params = {
    "includeUserPlant": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 23,
        "title": "ut",
        "content": "Ipsam quis atque vero et qui.",
        "status": "inna",
        "categories": "Historia rośliny",
        "priority": 1811835657,
        "photo_path": null,
        "user_plant_id": 16
    }
}
 

Request      

GET api/v1/note/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the note to be shown. Example: 1

Query Parameters

includeUserPlant   boolean  optional  

optional Include associated user plant in the response. Example: true

Update a note

requires authentication

Updates the details of an existing note based on the provided information.

Example request:
curl --request PUT \
    "https://leaflly.pl/api/v1/note/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"title\": \"civrc\",
    \"content\": \"fki\",
    \"status\": \"jxu\",
    \"categories\": \"Lista zakupów\",
    \"priority\": 4,
    \"photo_path\": \"tfedcptejsfo\",
    \"user_plant_id\": 16
}"
const url = new URL(
    "https://leaflly.pl/api/v1/note/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "title": "civrc",
    "content": "fki",
    "status": "jxu",
    "categories": "Lista zakupów",
    "priority": 4,
    "photo_path": "tfedcptejsfo",
    "user_plant_id": 16
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 24,
        "title": "veritatis",
        "content": null,
        "status": "ważna",
        "categories": "Inspiracje i pomysły",
        "priority": 949816581,
        "photo_path": null,
        "user_plant_id": 13
    }
}
 

Request      

PUT api/v1/note/{id}

PATCH api/v1/note/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the note to be updated. Example: 1

Body Parameters

title   string   

Must not be greater than 255 characters. Example: civrc

content   string   

Must not be greater than 255 characters. Example: fki

status   string   

Must not be greater than 56 characters. Example: jxu

Must be one of:
  • aktywna
  • archiwalne
  • ważna
  • inna
categories   string   

Example: Lista zakupów

Must be one of:
  • Problemy i Choroby
  • Podlewanie
  • Nawożenie
  • Inspiracje i pomysły
  • Plan pielęgnacji
  • Przycinanie
  • Historia rośliny
  • Środowisko
  • Lista zakupów
  • Wydarzenia
  • Inna
priority   integer   

Example: 4

photo_path   string   

Must not be greater than 255 characters. Example: tfedcptejsfo

user_plant_id   integer   

Example: 16

Delete a note

requires authentication

Removes a specified note from the database.

Example request:
curl --request DELETE \
    "https://leaflly.pl/api/v1/note/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/note/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/note/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the note to be deleted. Example: 1

Get Note Types

requires authentication

Retrieves a list of all available note types. This endpoint is useful for understanding the different types of notes that can be created or managed.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/note-types" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/note-types"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/note-types

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Note Statuses

requires authentication

Retrieves a list of all possible statuses for notes. This endpoint helps in identifying the various stages or states a note can be in.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/note-statuses" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/note-statuses"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/note-statuses

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Notification

Api for notifications management

Get all notifications

requires authentication

Retrieves a list of notifications with optional filters and includes related user plant data.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/notification" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/notification"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 26,
            "type": "Podlewanie",
            "title": "Non aperiam omnis nemo rerum excepturi enim nemo.",
            "message": "Asperiores quod occaecati est. Ut consequatur odio veniam rem qui. Harum eligendi inventore sit eum laborum laudantium. Ex est animi laboriosam eligendi.",
            "notification_date": "2024-01-25 15:59:35",
            "sent_on": null,
            "created_at": "2024-01-14T21:54:26.000000Z",
            "updated_at": "2024-01-14T21:54:26.000000Z"
        },
        {
            "id": 27,
            "type": "Przesadzanie",
            "title": "Sint omnis quos nisi alias optio.",
            "message": "Id cupiditate officia in est. Repudiandae quia cumque asperiores alias minus ut numquam. Eveniet suscipit corrupti consequuntur est. Quas eveniet iste mollitia esse doloremque itaque.",
            "notification_date": "2024-01-25 13:59:20",
            "sent_on": null,
            "created_at": "2024-01-14T21:54:26.000000Z",
            "updated_at": "2024-01-14T21:54:26.000000Z"
        }
    ]
}
 

Request      

GET api/v1/notification

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

includeUserPlants   boolean  optional  

optional Include associated user plants in the response.

sent_on[eq]   string  optional  

datetime Filter by read status of the notification.

type[eq]   string  optional  

Filter by notification type.

title[eq]   string  optional  

Filter by notification title.

notification_date[eq]   string  optional  

datetime Filter by the exact notification date.

notification_date[lt]   string  optional  

datetime Filter by notification date being less than.

notification_date[gt]   string  optional  

datetime Filter by notification date being greater than.

created_at[eq]   string  optional  

datetime Filter by the exact creation date.

created_at[lt]   string  optional  

datetime Filter by creation date being less than.

created_at[gt]   string  optional  

datetime Filter by creation date being greater than.

updated_at[eq]   string  optional  

datetime Filter by the exact update date.

updated_at[lt]   string  optional  

datetime Filter by update date being less than.

updated_at[gt]   string  optional  

datetime Filter by update date being greater than.

Create a new notification

requires authentication

Creates a new notification and associates it with a specified user plant.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/notification" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"type\": \"fnpjwpghrub\",
    \"title\": \"kulorr\",
    \"message\": \"zlxdiyedt\",
    \"notification_date\": \"2106-08-15\",
    \"sent_on\": \"2024-01-14T21:54:26\",
    \"user_plant_id\": 7
}"
const url = new URL(
    "https://leaflly.pl/api/v1/notification"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "type": "fnpjwpghrub",
    "title": "kulorr",
    "message": "zlxdiyedt",
    "notification_date": "2106-08-15",
    "sent_on": "2024-01-14T21:54:26",
    "user_plant_id": 7
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 28,
        "type": "Podlewanie",
        "title": "Rerum ipsum eveniet ad commodi aut et.",
        "message": "Aperiam dolorem sit est rerum quae quae quo. Amet est id nesciunt. Enim natus laboriosam et consectetur vitae. Corrupti impedit et sed nesciunt.",
        "notification_date": "2024-01-25 01:36:24",
        "sent_on": null,
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

POST api/v1/notification

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

type   string   

Must not be greater than 126 characters. Example: fnpjwpghrub

Must be one of:
  • Podlewanie
  • Zraszanie
  • Nawożenie
  • Przesadzanie
  • Kontrola
  • Oprysk
  • Przycinanie
  • Inne
title   string   

Must not be greater than 255 characters. Example: kulorr

message   string  optional  

Must not be greater than 3000 characters. Example: zlxdiyedt

notification_date   string   

Must be a valid date. Must be a date after or equal to today. Example: 2106-08-15

sent_on   string   

Must be a valid date. Example: 2024-01-14T21:54:26

user_plant_id   integer   

Example: 7

Show a notification

requires authentication

Retrieves details of a specific notification. Can optionally include associated user plant data.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/notification/1?includeUserPlants=1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/notification/1"
);

const params = {
    "includeUserPlants": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 29,
        "type": "Nawożenie",
        "title": "Ut dolores dignissimos facere natus.",
        "message": "Iusto facilis voluptatem architecto labore. Illo ducimus non qui voluptatum commodi ut exercitationem. Rerum animi hic excepturi saepe nisi dignissimos eveniet.",
        "notification_date": "2024-01-24 03:54:35",
        "sent_on": null,
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

GET api/v1/notification/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the notification to retrieve. Example: 1

Query Parameters

includeUserPlants   boolean  optional  

optional Include associated user plants in the response. Example: true

Update a notification

requires authentication

Updates the specified notification with provided details.

Example request:
curl --request PUT \
    "https://leaflly.pl/api/v1/notification/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"type\": null,
    \"title\": null,
    \"notification_date\": null,
    \"sent_on\": null
}"
const url = new URL(
    "https://leaflly.pl/api/v1/notification/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "type": null,
    "title": null,
    "notification_date": null,
    "sent_on": null
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 30,
        "type": "Inne",
        "title": "Id qui velit officia nemo delectus sint.",
        "message": "Quod cum id unde animi quidem. Unde quas est ea qui aspernatur mollitia. Quidem et deleniti impedit assumenda deleniti facilis.",
        "notification_date": "2024-01-26 03:51:57",
        "sent_on": null,
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

PUT api/v1/notification/{id}

PATCH api/v1/notification/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the notification to be updated. Example: 1

Body Parameters

type   string   

The type of the notification.

title   string   

The title of the notification.

message   string  optional  

nullable The message content of the notification.

notification_date   date   

The date and time for when the notification is scheduled.

sent_on   date   

Indicates if the notification has been read.

Delete a notification

requires authentication

Permanently deletes the specified notification from the database. This action is irreversible.

Example request:
curl --request DELETE \
    "https://leaflly.pl/api/v1/notification/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/notification/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/notification/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the notification to be deleted. Example: 1

Get Notification Types

requires authentication

Retrieves a list of all available notification types. This endpoint is useful for understanding the different types of notifications that can be sent or received in the system.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/notification-types" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/notification-types"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/notification-types

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Plant

Api for plants management

Get all plants

requires authentication

Retrieves a list of plants with optional filters and includes for related user plants.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/plant?search=%22Ficus%22" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/plant"
);

const params = {
    "search": ""Ficus"",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/plant

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

includeUserPlants   boolean  optional  

Include associated user plants in the response.

search   string  optional  

Allows searching for plants by name or species. Example: "Ficus"

name[eq]   string  optional  

Filter by plant name.

species[eq]   string  optional  

Filter by plant species.

plant_type[eq]   string  optional  

Filter by plant types.

soil_type[eq]   string  optional  

Filter by soil type.

target_height[eq]   integer  optional  

Filter by target height (equal).

insolation[eq]   string  optional  

Filter by insolation.

cultivation_difficulty[eq]   string  optional  

Filter by cultivation difficulty.

temperature[eq]   integer  optional  

Filter by temperature.

air_humidity[eq]   integer  optional  

Filter by air humidity.

toxicity[eq]   string  optional  

Filter by toxicity. Example:

ph[eq]   string  optional  

Filter by soil pH. Example:

Response

Response Fields

data   string[]   

of plant resources.

links      

Pagination links.

meta      

Pagination meta information.

Create a new plant

requires authentication

Stores a new plant record in the database.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/plant" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"psvqpf\",
    \"description\": \"Et eligendi velit sed quia itaque dolor numquam illum.\",
    \"species\": \"emcumbbiw\",
    \"plant_type\": \"nppxerdzkxrsznqbalnu\",
    \"image\": \"xugzdjqnhesgmyhnnc\",
    \"soil_type\": \"eimdhqq\",
    \"target_height\": \"aut\",
    \"insolation\": \"mdvmgitulgetfihjqtv\",
    \"cultivation_difficulty\": \"uvcqwuwhfzqyitprxcex\",
    \"temperature\": \"qla\",
    \"air_humidity\": \"hcttvqpouscbkniuc\",
    \"toxicity\": 11,
    \"ph\": \"ioxgyehtvguhoovfqgpnqzsrolqmx\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/plant"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "psvqpf",
    "description": "Et eligendi velit sed quia itaque dolor numquam illum.",
    "species": "emcumbbiw",
    "plant_type": "nppxerdzkxrsznqbalnu",
    "image": "xugzdjqnhesgmyhnnc",
    "soil_type": "eimdhqq",
    "target_height": "aut",
    "insolation": "mdvmgitulgetfihjqtv",
    "cultivation_difficulty": "uvcqwuwhfzqyitprxcex",
    "temperature": "qla",
    "air_humidity": "hcttvqpouscbkniuc",
    "toxicity": 11,
    "ph": "ioxgyehtvguhoovfqgpnqzsrolqmx"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/plant

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: psvqpf

description   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: Et eligendi velit sed quia itaque dolor numquam illum.

species   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: emcumbbiw

plant_type   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: nppxerdzkxrsznqbalnu

Must be one of:
  • Kaktusy i sukulenty
  • Rośliny zielone
  • Rośliny kwitnące
  • Rośliny pnące i zwisające
  • Palmy
  • Paprocie
  • Byliny
image   string   

Must be at least 6 characters. Must not be greater than 255 characters. Example: xugzdjqnhesgmyhnnc

soil_type   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: eimdhqq

Must be one of:
  • ziemia ogrodowa
  • ziemia kompostowa
  • ziemia żyzna i pruchnicza
  • torf wysoki
  • ziemia dla kaktusów i sukulentów
  • podłoża dla storczyków
  • podłoże do uprawy hydroponicznej
target_height   string   

Example: aut

insolation   string   

Must not be greater than 128 characters. Example: mdvmgitulgetfihjqtv

Must be one of:
  • pełne słońce
  • półcień
  • cień
cultivation_difficulty   string   

Must be at least 3 characters. Must not be greater than 64 characters. Example: uvcqwuwhfzqyitprxcex

Must be one of:
  • łatwy
  • średni
  • trudny
temperature   string   

Must be at least 3 characters. Must not be greater than 64 characters. Example: qla

air_humidity   string   

Must be at least 3 characters. Must not be greater than 64 characters. Example: hcttvqpouscbkniuc

toxicity   integer  optional  

Example: 11

ph   string  optional  

Must be at least 3 characters. Example: ioxgyehtvguhoovfqgpnqzsrolqmx

Show a plant

requires authentication

Retrieves detailed information about a specific plant. Optionally includes related user plant data.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/plant/1?includeUserPlants=1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/plant/1"
);

const params = {
    "includeUserPlants": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 49,
        "name": "enim aut quis",
        "description": "Quos voluptates in temporibus ut magnam eum quo ut.",
        "species": "doloremque vel",
        "plant_type": "Rośliny kwitnące",
        "image": "https://via.placeholder.com/640x480.png/00bbee?text=libero",
        "soil_type": "podłoże do uprawy hydroponicznej",
        "target_height": "53",
        "insolation": "półcień",
        "cultivation_difficulty": "trudny",
        "temperature": "25°C - 31°C",
        "air_humidity": "36% - 63%",
        "toxicity": 2,
        "ph": "5.07 - 9.78",
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

GET api/v1/plant/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the plant. Example: 1

Query Parameters

includeUserPlants   boolean  optional  

optional Include associated user plants in the response. Example: true

Response

Response Fields

data   object   

The data of the plant including optional user plants.

Update a plant

requires authentication

Updates the details of an existing plant based on the provided information.

Example request:
curl --request PUT \
    "https://leaflly.pl/api/v1/plant/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"iyyy\",
    \"description\": \"Consequatur dolores dignissimos perferendis qui dolorem.\",
    \"species\": \"thabzkkngbfzwbghigh\",
    \"plant_type\": \"junn\",
    \"image\": \"g\",
    \"soil_type\": \"nlxhybgsu\",
    \"target_height\": \"id\",
    \"insolation\": \"pzarqusbdcgepxxeayi\",
    \"cultivation_difficulty\": \"aosvcwsfzgs\",
    \"temperature\": \"vygebmtzzu\",
    \"air_humidity\": \"ynivwmka\",
    \"toxicity\": 11,
    \"ph\": \"asqkgyrdvyfcwziirxuhaouhgikkhnialsgsal\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/plant/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "iyyy",
    "description": "Consequatur dolores dignissimos perferendis qui dolorem.",
    "species": "thabzkkngbfzwbghigh",
    "plant_type": "junn",
    "image": "g",
    "soil_type": "nlxhybgsu",
    "target_height": "id",
    "insolation": "pzarqusbdcgepxxeayi",
    "cultivation_difficulty": "aosvcwsfzgs",
    "temperature": "vygebmtzzu",
    "air_humidity": "ynivwmka",
    "toxicity": 11,
    "ph": "asqkgyrdvyfcwziirxuhaouhgikkhnialsgsal"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 50,
        "name": "rem qui voluptas",
        "description": "Est cupiditate quas omnis quas est expedita.",
        "species": "aut dignissimos",
        "plant_type": "Rośliny pnące i zwisające",
        "image": "https://via.placeholder.com/640x480.png/008888?text=autem",
        "soil_type": "podłoże do uprawy hydroponicznej",
        "target_height": "83",
        "insolation": "półcień",
        "cultivation_difficulty": "trudny",
        "temperature": "11°C - 33°C",
        "air_humidity": "42% - 56%",
        "toxicity": 1,
        "ph": "5.91 - 9.68",
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

PUT api/v1/plant/{id}

PATCH api/v1/plant/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the plant to be updated. Example: 1

Body Parameters

name   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: iyyy

description   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: Consequatur dolores dignissimos perferendis qui dolorem.

species   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: thabzkkngbfzwbghigh

plant_type   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: junn

Must be one of:
  • Kaktusy i sukulenty
  • Rośliny zielone
  • Rośliny kwitnące
  • Rośliny pnące i zwisające
  • Palmy
  • Paprocie
  • Byliny
image   string   

Must be at least 6 characters. Must not be greater than 255 characters. Example: g

soil_type   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: nlxhybgsu

Must be one of:
  • ziemia ogrodowa
  • ziemia kompostowa
  • ziemia żyzna i pruchnicza
  • torf wysoki
  • ziemia dla kaktusów i sukulentów
  • podłoża dla storczyków
  • podłoże do uprawy hydroponicznej
target_height   string   

Example: id

insolation   string   

Must not be greater than 128 characters. Example: pzarqusbdcgepxxeayi

Must be one of:
  • pełne słońce
  • półcień
  • cień
cultivation_difficulty   string   

Must be at least 3 characters. Must not be greater than 64 characters. Example: aosvcwsfzgs

Must be one of:
  • łatwy
  • średni
  • trudny
temperature   string   

Must be at least 3 characters. Must not be greater than 64 characters. Example: vygebmtzzu

air_humidity   string   

Must be at least 3 characters. Must not be greater than 64 characters. Example: ynivwmka

toxicity   integer   

Example: 11

ph   string   

Must be at least 3 characters. Example: asqkgyrdvyfcwziirxuhaouhgikkhnialsgsal

Delete a plant

requires authentication

Removes a specified plant from the database.

Example request:
curl --request DELETE \
    "https://leaflly.pl/api/v1/plant/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/plant/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/plant/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the plant to be deleted. Example: 1

Get plant types

requires authentication

Returns an array of strings, each representing a distinct type of plant. This endpoint is useful for populating dropdowns or filters in the UI.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/plant-types" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/plant-types"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/plant-types

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Soil Types

requires authentication

Retrieves a list of all available soil types for plants. Useful for filters and understanding suitable soil conditions for different plants.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/soil-types" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/soil-types"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/soil-types

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Insolation Types

requires authentication

Retrieves a list of all available insolation types. This helps in understanding the amount and intensity of sunlight required by different plants.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/insolation-types" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/insolation-types"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/insolation-types

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Get Difficulty Types

requires authentication

Retrieves a list of different difficulty levels for growing and maintaining plants. Useful for users to select plants based on their gardening experience.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/difficulty-types" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/difficulty-types"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/difficulty-types

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Push notifications

Save Device Token

requires authentication

Saves the FCM device token to the authenticated user's profile.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/save-token" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"token\": \"your-device-token\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/save-token"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "token": "your-device-token"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/save-token

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

token   string   

The FCM device token to be saved. Example: your-device-token

Send a Push Notification

requires authentication

Sends a push notification to a specified device token using Firebase Cloud Messaging (FCM).

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/send-notification" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"deviceToken\": \"quibusdam\",
    \"title\": \"nulla\",
    \"body\": \"dolores\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/send-notification"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "deviceToken": "quibusdam",
    "title": "nulla",
    "body": "dolores"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/send-notification

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

deviceToken   string  optional  

The FCM device token of the target device. Example: quibusdam

title   string  optional  

The title of the notification. Example: nulla

body   string  optional  

The body text of the notification. Example: dolores

Send a Test Notification

requires authentication

Sends a test push notification to a specified device token. This endpoint is useful for testing the push notification functionality in the development environment.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/test-notification" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"token\": \"your-device-token\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/test-notification"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "token": "your-device-token"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/test-notification

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

token   string   

The FCM device token to which the test notification will be sent. Example: your-device-token

User

Api for users management

Get all users

requires authentication

Retrieves a list of users with optional filters and includes for related user plants.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/user" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/user"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 42,
            "name": "Karley Skiles",
            "email": "kreiger.gust@example.org",
            "email_verified_at": "2024-01-14T21:54:26.000000Z",
            "created_at": "2024-01-14T21:54:26.000000Z",
            "updated_at": "2024-01-14T21:54:26.000000Z"
        },
        {
            "id": 43,
            "name": "Prof. Myron Stoltenberg MD",
            "email": "mbrown@example.com",
            "email_verified_at": "2024-01-14T21:54:26.000000Z",
            "created_at": "2024-01-14T21:54:26.000000Z",
            "updated_at": "2024-01-14T21:54:26.000000Z"
        }
    ]
}
 

Request      

GET api/v1/user

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

includeUserPlants   boolean  optional  

Include associated user plants in the response.

name[eq]   string  optional  

Filter by user name.

email[eq]   string  optional  

Filter by email address.

email_verified_at[eq]   string  optional  

datetime Filter by the exact date and time when the email was verified.

email_verified_at[lt]   string  optional  

datetime Filter by email verified date being less than.

email_verified_at[gt]   string  optional  

datetime Filter by email verified date being greater than.

created_at[eq]   string  optional  

datetime Filter by exact creation date.

created_at[lt]   string  optional  

datetime Filter by creation date being less than.

created_at[gt]   string  optional  

datetime Filter by creation date being greater than.

updated_at[eq]   string  optional  

datetime Filter by exact update date.

updated_at[lt]   string  optional  

datetime Filter by update date being less than.

updated_at[gt]   string  optional  

datetime Filter by update date being greater than.

Get a single user

requires authentication

Retrieves the details of a specific user and optionally includes related user plant data.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/user/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/user/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 44,
        "name": "Nettie Sanford",
        "email": "kschmitt@example.net",
        "email_verified_at": "2024-01-14T21:54:26.000000Z",
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

GET api/v1/user/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the user to retrieve. Example: 1

Query Parameters

includeUserPlants   boolean  optional  

optional Include associated user plants in the response.

Update a user

requires authentication

Updates the specified user's details. Fields are updated only if they are provided.

Example request:
curl --request PUT \
    "https://leaflly.pl/api/v1/user/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"lnvoikznhtzpvjhi\",
    \"email\": \"dominique28@example.net\",
    \"current_password\": \"currentPassword123\",
    \"password\": \"qui\",
    \"password_confirmation\": \"newPassword123\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/user/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "lnvoikznhtzpvjhi",
    "email": "dominique28@example.net",
    "current_password": "currentPassword123",
    "password": "qui",
    "password_confirmation": "newPassword123"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 45,
        "name": "Fatima Heathcote",
        "email": "karlie77@example.com",
        "email_verified_at": "2024-01-14T21:54:26.000000Z",
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

PUT api/v1/user/{id}

PATCH api/v1/user/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the user to update. Example: 1

Body Parameters

name   string   

Must not be greater than 255 characters. Example: lnvoikznhtzpvjhi

email   string   

Must be a valid email address. Must not be greater than 255 characters. Example: dominique28@example.net

current_password   string   

The current password of the user for verification. Example: currentPassword123

password   string   

Example: qui

password_confirmation   string  optional  

required_with:password The confirmation of the new password. Example: newPassword123

Delete a user

requires authentication

Permanently deletes the specified user from the database. This action is irreversible.

Example request:
curl --request DELETE \
    "https://leaflly.pl/api/v1/user/2" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/user/2"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/user/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the user to be deleted. Example: 2

User Authentication

User authentication endpoints.

Logout user

requires authentication

Logs out the specified user by invalidating their access token.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/auth/logout" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"userId\": 2
}"
const url = new URL(
    "https://leaflly.pl/api/v1/auth/logout"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "userId": 2
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "message": "User successfully logged out"
}
 

Example response (401):


{
    "message": "Unauthenticated"
}
 

Example response (404):


{
    "message": "User not found"
}
 

Request      

POST api/v1/auth/logout

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

userId   integer   

The ID of the user to log out. Example: 2

Register User

requires authentication

Register a new user.

Example request:
curl --request POST \
    "https://leaflly.pl/api/auth/register" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"natus\",
    \"email\": \"hhickle@example.org\",
    \"password\": \":}K*wGk&\",
    \"password_confirmation\": null
}"
const url = new URL(
    "https://leaflly.pl/api/auth/register"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "natus",
    "email": "hhickle@example.org",
    "password": ":}K*wGk&",
    "password_confirmation": null
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": true,
    "message": "User Created Successfully",
    "token": "API TOKEN"
}
 

Example response (401):


{
    "status": false,
    "message": "Validation error",
    "errors": {}
}
 

Example response (500):


{
    "status": false,
    "message": "Internal Server Error"
}
 

Request      

POST api/auth/register

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

The user's name. Example: natus

email   string   

The user's email address. Example: hhickle@example.org

password   string   

The user's password. Example: :}K*wGk&

password_confirmation   string   

Confirm the user's password.

Login User

requires authentication

Log in a user.

Example request:
curl --request POST \
    "https://leaflly.pl/api/auth/login" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"ygleichner@example.com\",
    \"password\": \"FC|9NEA.7\\\"\"
}"
const url = new URL(
    "https://leaflly.pl/api/auth/login"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "ygleichner@example.com",
    "password": "FC|9NEA.7\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": true,
    "message": "User Logged In Successfully",
    "token": "API TOKEN"
}
 

Example response (401):


{
    "status": false,
    "message": "Email & Password does not match with our record."
}
 

Example response (500):


{
    "status": false,
    "message": "Internal Server Error"
}
 

Request      

POST api/auth/login

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

The user's email address. Example: ygleichner@example.com

password   string   

The user's password. Example: FC|9NEA.7"

Forgot Password

requires authentication

Request a password reset link for a user with the given email.

Example request:
curl --request POST \
    "https://leaflly.pl/api/forgot-password" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"user@example.com\"
}"
const url = new URL(
    "https://leaflly.pl/api/forgot-password"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "user@example.com"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "status": "passwords.sent"
}
 

Example response (400):


{
    "message": "Nie udało się wysłać linku resetującego hasło."
}
 

Request      

POST api/forgot-password

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   required  optional  

The email address of the user. Example: user@example.com

Verify a user's email address.

requires authentication

Verify the email address of a registered user using the provided $userId and $hash.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/verify-email/quos/error" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/verify-email/quos/error"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 6
x-ratelimit-remaining: 5
access-control-allow-origin: *
 

{
    "message": "No query results for model [App\\Models\\User] quos"
}
 

Request      

GET api/verify-email/{id}/{hash}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the verify email. Example: quos

hash   string   

Example: error

Reset Password

requires authentication

Reset the user's password.

Example request:
curl --request POST \
    "https://leaflly.pl/reset-password" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"token\": \"nesciunt\",
    \"email\": \"rey.lind@example.org\",
    \"password\": \"l@V}gP6BwIo^g\'*\",
    \"password_confirmation\": \"doloribus\"
}"
const url = new URL(
    "https://leaflly.pl/reset-password"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "token": "nesciunt",
    "email": "rey.lind@example.org",
    "password": "l@V}gP6BwIo^g'*",
    "password_confirmation": "doloribus"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "message": "Hasło zostało zresetowane."
}
 

Example response (400):


{
    "message": "Nie udało się zresetować hasła."
}
 

Request      

POST reset-password

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

token   string   

The token received in the password reset email. Example: nesciunt

email   string   

The user's email address. Example: rey.lind@example.org

password   string   

The new password. Example: l@V}gP6BwIo^g'*

password_confirmation   string   

The new password confirmation. Example: doloribus

UserPlants

Api for user plants management

Get all user plants

requires authentication

Retrieves a list of user plants with optional filters and includes for related entities.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/userPlant?search=%22Ficus%22" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"includePlant\": true,
    \"includeNotes\": false,
    \"includeUser\": false
}"
const url = new URL(
    "https://leaflly.pl/api/v1/userPlant"
);

const params = {
    "search": ""Ficus"",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "includePlant": true,
    "includeNotes": false,
    "includeUser": false
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 21,
            "user_id": 1,
            "plant_id": 43,
            "custom_name": "amet non optio",
            "location": "inna",
            "last_watered": "2024-01-02 11:09:25",
            "created_at": "2024-01-14T21:54:26.000000Z",
            "updated_at": "2024-01-14T21:54:26.000000Z"
        },
        {
            "id": 22,
            "user_id": 39,
            "plant_id": 2,
            "custom_name": "voluptates voluptatem neque",
            "location": "balkon",
            "last_watered": "2024-01-03 08:56:40",
            "created_at": "2024-01-14T21:54:26.000000Z",
            "updated_at": "2024-01-14T21:54:26.000000Z"
        }
    ]
}
 

Request      

GET api/v1/userPlant

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

includePlant   boolean  optional  

Include associated plant in the response.

includeUser   boolean  optional  

Include associated user in the response.

includeNotes   boolean  optional  

Include associated notes in the response.

search   string  optional  

Allows searching for plants by name or species. Example: "Ficus"

user_id[eq]   integer  optional  

Filter by user ID.

plant_id[eq]   integer  optional  

Filter by plant ID.

custom_name[eq]   string  optional  

Filter by custom name.

location[eq]   string  optional  

Filter by location.

last_watered[eq]   string  optional  

Filter by exact last watered date.

last_watered[lt]   string  optional  

Filter by last watered date being less than.

last_watered[gt]   string  optional  

Filter by last watered date being greater than.

Body Parameters

includePlant   boolean  optional  

Example: true

includeNotes   boolean  optional  

Example: false

includeUser   boolean  optional  

Example: false

Store a newly created user's plant in storage.

requires authentication

Creates and stores a new user's plant in the database.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/userPlant" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"user_id\": 3,
    \"plant_id\": 10,
    \"custom_name\": \"oklknckkyjwayar\",
    \"location\": \"rmsoshwaurrmwiwrmgkycydps\",
    \"last_watered\": \"2024-01-14T21:54:26\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/userPlant"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "user_id": 3,
    "plant_id": 10,
    "custom_name": "oklknckkyjwayar",
    "location": "rmsoshwaurrmwiwrmgkycydps",
    "last_watered": "2024-01-14T21:54:26"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 23,
        "user_id": 23,
        "plant_id": 6,
        "custom_name": "repellendus velit veritatis",
        "location": "łazienka",
        "last_watered": "2024-01-02 12:32:59",
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

POST api/v1/userPlant

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

user_id   integer  optional  

Example: 3

plant_id   integer   

Example: 10

custom_name   string  optional  

Must be at least 3 characters. Must not be greater than 255 characters. Example: oklknckkyjwayar

location   string  optional  

Must be at least 3 characters. Must not be greater than 128 characters. Example: rmsoshwaurrmwiwrmgkycydps

Must be one of:
  • kuchnia
  • łazienka
  • sypialnia
  • salon
  • korytarz
  • pokój dzieci
  • pokój gościnny
  • biuro
  • balkon
  • inna
last_watered   string  optional  

Must be a valid date. Example: 2024-01-14T21:54:26

Get a single UserPlant with relations

requires authentication

Retrieve a single UserPlant and optionally include its related entities such as notes and user details.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/userPlant/1?includePlant=1&includeNotes=1&includeUser=1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"includePlant\": true,
    \"includeNotes\": true,
    \"includeUser\": true
}"
const url = new URL(
    "https://leaflly.pl/api/v1/userPlant/1"
);

const params = {
    "includePlant": "1",
    "includeNotes": "1",
    "includeUser": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "includePlant": true,
    "includeNotes": true,
    "includeUser": true
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 24,
        "user_id": 28,
        "plant_id": 42,
        "custom_name": "quo sit impedit",
        "location": "pokój dzieci",
        "last_watered": "2024-01-01 12:05:41",
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

GET api/v1/userPlant/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the userPlant. Example: 1

Query Parameters

includePlant   boolean  optional  

Optional parameter to include plant details. Example: true

includeNotes   boolean  optional  

Optional parameter to include plant notes. Example: true

includeUser   boolean  optional  

Optional parameter to include user details. Example: true

Body Parameters

includePlant   boolean  optional  

Example: true

includeNotes   boolean  optional  

Example: true

includeUser   boolean  optional  

Example: true

Update a UserPlant

requires authentication

Update the details of a UserPlant with given ID. Allows updating the associated plant, user, custom name, location, and last watered date.

Example request:
curl --request PUT \
    "https://leaflly.pl/api/v1/userPlant/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"user_id\": 20,
    \"plant_id\": 19,
    \"custom_name\": \"pghxhlryffcvomvhsfho\",
    \"location\": \"sbqvfvnjrat\",
    \"last_watered\": \"2024-01-14T21:54:26\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/userPlant/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "user_id": 20,
    "plant_id": 19,
    "custom_name": "pghxhlryffcvomvhsfho",
    "location": "sbqvfvnjrat",
    "last_watered": "2024-01-14T21:54:26"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 25,
        "user_id": 38,
        "plant_id": 8,
        "custom_name": "reprehenderit libero iure",
        "location": "sypialnia",
        "last_watered": "2024-01-06 22:48:03",
        "created_at": "2024-01-14T21:54:26.000000Z",
        "updated_at": "2024-01-14T21:54:26.000000Z"
    }
}
 

Request      

PUT api/v1/userPlant/{id}

PATCH api/v1/userPlant/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the User Plant to be updated. Example: 1

Body Parameters

user_id   integer   

Example: 20

plant_id   integer   

Example: 19

custom_name   string   

Must be at least 3 characters. Must not be greater than 255 characters. Example: pghxhlryffcvomvhsfho

location   string   

Must be at least 3 characters. Must not be greater than 128 characters. Example: sbqvfvnjrat

Must be one of:
  • kuchnia
  • łazienka
  • sypialnia
  • salon
  • korytarz
  • pokój dzieci
  • pokój gościnny
  • biuro
  • balkon
  • inna
last_watered   string   

Must be a valid date. Example: 2024-01-14T21:54:26

Remove a UserPlant

requires authentication

Removes a specified UserPlant resource from storage.

Example request:
curl --request DELETE \
    "https://leaflly.pl/api/v1/userPlant/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/userPlant/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Roślina użytkownika została pomyślnie usunięty."
}
 

Example response (404):


{
    "message": "Nie znaleziono rośliny użytkownika o podanym identyfikatorze."
}
 

Request      

DELETE api/v1/userPlant/{id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the UserPlant to remove. Example: 1

Get Available Locations

requires authentication

Retrieves a list of all available locations where plants can be placed or are being maintained. This endpoint is useful for users looking to understand where they can place or find their plants.

Example request:
curl --request GET \
    --get "https://leaflly.pl/api/v1/userPlant-locations" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/userPlant-locations"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/userPlant-locations

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

User Roles

Add a role to a user

requires authentication

Assigns a specified role to a user. Only accessible by administrators.

Example request:
curl --request POST \
    "https://leaflly.pl/api/v1/users/1/roles" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"role\": \"editor\"
}"
const url = new URL(
    "https://leaflly.pl/api/v1/users/1/roles"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "role": "editor"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, success):


{
    "message": "Role added successfully"
}
 

Example response (404, role not found):


{
    "message": "Role not found"
}
 

Request      

POST api/v1/users/{user_id}/roles

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

user_id   integer   

The ID of the user. Example: 1

Body Parameters

role   string   

The name of the role to assign to the user. Example: editor

Remove a role from a user

requires authentication

Detaches a specified role from a user. Only accessible by administrators.

Example request:
curl --request DELETE \
    "https://leaflly.pl/api/v1/users/1/roles/1" \
    --header "Authorization: Bearer 1|Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://leaflly.pl/api/v1/users/1/roles/1"
);

const headers = {
    "Authorization": "Bearer 1|Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200, success):


{
    "message": "Role removed successfully"
}
 

Request      

DELETE api/v1/users/{user_id}/roles/{role_id}

Headers

Authorization      

Example: Bearer 1|Token

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

user_id   integer   

The ID of the user. Example: 1

role_id   integer   

The ID of the role. Example: 1