REST API

Poniżej przedstawiam przykładowe zapytania i odpowiedzi

Endpoint-y nie wymagające autoryzacji:

POST: api/login (logowanie)
Array
(
    [email] => test@email.com
    [password] => cmsrs
)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [token] => eyJ0eXAiOiJK...7nhyflrqY-xA
        )
)

Walidacja:

stdClass Object
(
    [success] => 
    [error] => We cant find an account with this credentials.
)
POST: api/comments/$pageId (utworzenie komentarza)
Array
(
    [content] => test comment - test123
)
stdClass Object
(
    [success] => 1
)
GET: api/comments/$pageId (zwracamy komentarze)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [content] => 111 test comment - test123
                )

            [1] => stdClass Object
                (
                    [content] => 222 test comment - test123
                )
        )
)
POST: api/contact/$lang (utworzenie wiadomości kontaktowej)
Array
(
    [email] => test@example.com
    [message] => test message - test123
)
stdClass Object
(
    [success] => 1
    [message] => Dziękuje za skorzystanie z formularza kontaktowego
)
GET: api/page/$pageId/$lang (zwracamy stronę)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [id] => 1
            [type] => cms
            [images] => Array
                (
                    [0] => stdClass Object
                        (
                            [org] => /images/page/1/1/phpunittest1.jpg
                            [small] => /images/page/1/1/phpunittest1-small.jpg
                            [medium] => /images/page/1/1/phpunittest1-medium.jpg
                            [id] => 1
                            [alt] => stdClass Object
                                (
                                    [en] => description img1
                                )

                            [altlang] => description img1
                        )

                    [1] => stdClass Object
                        (
                            [org] => /images/page/1/2/phpunittest2.jpg
                            [small] => /images/page/1/2/phpunittest2-small.jpg
                            [medium] => /images/page/1/2/phpunittest2-medium.jpg
                            [id] => 2
                            [alt] => stdClass Object
                                (
                                    [en] => 
                                )

                            [altlang] => 
                        )
                )
        )
)
GET: api/productsGetNameAndPrice/$lang (zwracamy wszystkie produkty, api używane w koszyku)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [1] => stdClass Object
                (
                    [price] => 123
                    [name] => php3 db app
                    [url_product] => /cms/books/programmer/php3-db-app
                    [url_image] => /images/product/1/1/phpunittest1-small.jpg
                )

            [2] => stdClass Object
                (
                    [price] => 123
                    [name] => product name uniq en2
                    [url_product] => /cms/books/programmer/product-name-uniq-en2
                    [url_image] => /images/product/2/3/phpunittest1-small.jpg
                )

        )

)

Endpoint-y wymagające autoryzacji:

Strony:

POST: api/pages?token=$token (utworzenie strony)
Array
(
    [title] => Array
        (
            [en] => test p2
        )

    [short_title] => Array
        (
            [en] => p22
        )

    [description] => Array
        (
            [en] => test1234
        )

    [published] => 0
    [commented] => 0
    [after_login] => 0
    [type] => contact
    [content] => Array
        (
            [en] => lorem ipsum
        )

    [menu_id] => 
    [page_id] => 
    [images] => Array
        (
            [0] => Array
                (
                    [name] => phpunittest1.jpg
                    [data] => data:image/jpg;base64,/9j/4AAQSkZ..rAFS6G7Jr1PeP/9k=
                    [alt] => Array
                        (
                            [en] => description img1
                        )
                )
            [1] => Array
                (
                    [name] => phpunittest2.jpg
                    [data] => data:image/jpg;base64,/9j/4AAQSkZJRg...wRV82DVqaZSCAev/Z
                )
        )
)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [pageId] => 1
            [data] => stdClass Object
                (
                    [title] => stdClass Object
                        (
                            [en] => test p2
                        )

                    [short_title] => stdClass Object
                        (
                            [en] => p22
                        )

                    [description] => stdClass Object
                        (
                            [en] => test1234
                        )

                    [published] => 0
                    [commented] => 0
                    [after_login] => 0
                    [type] => contact
                    [content] => stdClass Object
                        (
                            [en] => lorem ipsum
                        )

                    [menu_id] => 
                    [page_id] => 
                    [images] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [name] => phpunittest1.jpg
                                    [data] => data:image/jpg;base64,/9j/4AA....WTrAFS6G7Jr1PeP/9k=
                                    [alt] => stdClass Object
                                        (
                                            [en] => description img1
                                        )

                                )

                            [1] => stdClass Object
                                (
                                    [name] => phpunittest2.jpg
                                    [data] => data:image/jpg;base64,/9j/4A...DVqaZSCAev/Z
                                )
                        )
                )
        )
)
GET: api/pages?token=$token (pobieramy strony)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [published] => 0
                    [commented] => 0
                    [after_login] => 0
                    [position] => 1
                    [type] => contact
                    [menu_id] => 
                    [page_id] => 
                    [title] => stdClass Object
                        (
                            [en] => test p2
                        )
                    [short_title] => stdClass Object
                        (
                            [en] => p22
                        )
                    [description] => stdClass Object
                        (
                            [en] => test1234
                        )
                    [content] => stdClass Object
                        (
                            [en] => lorem ipsum
                        )
                    [images] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [id] => 1
                                    [name] => phpunittest1.jpg
                                    [position] => 1
                                    [page_id] => 1
                                    [product_id] => 
                                    [created_at] => 2020-11-20T15:38:20.000000Z
                                    [updated_at] => 2020-11-20T15:38:20.000000Z
                                    [alt] => stdClass Object
                                        (
                                            [en] => description img1
                                        )

                                    [fs] => stdClass Object
                                        (
                                            [org] => /images/page/1/1/phpunittest1.jpg
                                            [small] => /images/page/1/1/phpunittest1-small.jpg
                                            [medium] => /images/page/1/1/phpunittest1-medium.jpg
                                        )
                                )

                            [1] => stdClass Object
                                (
                                    [id] => 2
                                    [name] => phpunittest2.jpg
                                    [position] => 2
                                    [page_id] => 1
                                    [product_id] => 
                                    [created_at] => 2020-11-20T15:38:20.000000Z
                                    [updated_at] => 2020-11-20T15:38:20.000000Z
                                    [alt] => stdClass Object
                                        (
                                            [en] => 
                                        )

                                    [fs] => stdClass Object
                                        (
                                            [org] => /images/page/1/2/phpunittest2.jpg
                                            [small] => /images/page/1/2/phpunittest2-small.jpg
                                            [medium] => /images/page/1/2/phpunittest2-medium.jpg
                                        )
                                )
                        )
                )
        )
)
GET: api/pages/$pageId/{?$simple}?token=$token (pobieramy strone o danym Id, jesli jest simple wtedy pobieramy bez images)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [id] => 1
            [published] => 0
            [commented] => 0
            [after_login] => 0
            [position] => 1
            [type] => contact
            [menu_id] => 
            [page_id] => 
            [title] => stdClass Object
                (
                    [en] => test p2
                )

            [short_title] => stdClass Object
                (
                    [en] => p22
                )

            [description] => stdClass Object
                (
                    [en] => test1234
                )

            [content] => stdClass Object
                (
                    [en] => lorem ipsum
                )

            [images] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 1
                            [name] => phpunittest1.jpg
                            [position] => 1
                            [page_id] => 1
                            [product_id] => 
                            [created_at] => 2024-04-24T17:39:06.000000Z
                            [updated_at] => 2024-04-24T17:39:06.000000Z
                            [alt] => stdClass Object
                                (
                                    [en] => description img1
                                )

                            [fs] => stdClass Object
                                (
                                    [org] => /images/page/1/1/phpunittest1.jpg
                                    [small] => /images/page/1/1/phpunittest1-small.jpg
                                    [medium] => /images/page/1/1/phpunittest1-medium.jpg
                                )

                        )

                    [1] => stdClass Object
                        (
                            [id] => 2
                            [name] => phpunittest2.jpg
                            [position] => 2
                            [page_id] => 1
                            [product_id] => 
                            [created_at] => 2024-04-24T17:39:06.000000Z
                            [updated_at] => 2024-04-24T17:39:06.000000Z
                            [alt] => stdClass Object
                                (
                                    [en] => 
                                )

                            [fs] => stdClass Object
                                (
                                    [org] => /images/page/1/2/phpunittest2.jpg
                                    [small] => /images/page/1/2/phpunittest2-small.jpg
                                    [medium] => /images/page/1/2/phpunittest2-medium.jpg
                                )
                        )
                )
        )
)
PUT: api/pages/$id?token=$token (uaktualniamy stronę)
Array
(
    [title] => Array
        (
            [en] => Update img Title
        )

    [short_title] => Array
        (
            [en] => test123
        )

    [images] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [alt] => Array
                        (
                            [en] => alt1
                        )

                )

            [1] => Array
                (
                    [id] => 2
                    [alt] => Array
                        (
                            [en] => alt2
                        )

                )

            [2] => Array
                (
                    [name] => phpunittest2.jpg
                    [data] => data:image/jpg;base64,/9j/4A...V82DVqaZSCAev/Z
                )

            [3] => Array
                (
                    [name] => phpunittest2.jpg
                    [data] => data:image/jpg;base64,/9j/4AA...xuwRV82DVqaZSCAev/Z
                )
        )
)
tylko dla instnejacych zdjęć

Array
(
    [title] => Array
        (
            [en] => Update2 img Title
        )

    [short_title] => Array
        (
            [en] => u2 test123
        )

    [images] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [alt] => Array
                        (
                            [en] => last
                        )

                    [position] => 202
                )

            [1] => Array
                (
                    [id] => 2
                    [alt] => Array
                        (
                            [en] => first
                        )

                    [position] => 101
                )
        )
)
stdClass Object
(
    [success] => 1
)
DELETE: api/pages/$id?token=$token (kasujemy stronę)
stdClass Object
(
    [success] => 1
)
PATCH: api/pages/position/$direction/$id?token=$token (ustawiamy pozycję strony, gdzie $direction: up, down)
stdClass Object
(
    [success] => 1
)
GET: api/pages/type/$type (zwróć strony na podstawie typu, gdzie $type: cms, gallery, shop, contact, main_page, privacy_policy, login, projects)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [published] => 0
                    [commented] => 0
                    [after_login] => 0
                    [position] => 1
                    [type] => shop
                    [menu_id] => 
                    [page_id] => 
                    [title] => stdClass Object
                        (
                            [en] => test p2
                        )

                    [short_title] => stdClass Object
                        (
                            [en] => p22
                        )

                    [description] => stdClass Object
                        (
                            [en] => 
                        )

                    [content] => stdClass Object
                        (
                            [en] => aaa ffdfds
                        )

                    [images] => Array
                        (
                        )
                )
        )
)

Zdjęcia:

POST: api/image/$type/$objId?token=$token (upload obrazka, gdzie $type: page, product, $objId: pageId, productId)
Array
(
    [name] => phpunittest2.jpg
    [data] => data:image/jpg;base64,/9j/4AAQSkZJRgABAQ..ev/Z
)

stdClass Object
(
    [success] => 1
)
GET: api/images/$type/$objId?token=$token (zwracamy obrazki, gdzie $type: page, product, $objId: pageId, productId)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [name] => phpunittest1.jpg
                    [position] => 1
                    [page_id] => 1
                    [product_id] => 
                    [created_at] => 2020-11-22T16:38:46.000000Z
                    [updated_at] => 2020-11-22T16:38:46.000000Z
                    [alt] => stdClass Object
                        (
                            [en] => description img1
                        )

                    [fs] => stdClass Object
                        (
                            [org] => /images/page/1/1/phpunittest1.jpg
                            [small] => /images/page/1/1/phpunittest1-small.jpg
                            [medium] => /images/page/1/1/phpunittest1-medium.jpg
                        )

                )

            [1] => stdClass Object
                (
                    [id] => 2
                    [name] => phpunittest2.jpg
                    [position] => 2
                    [page_id] => 1
                    [product_id] => 
                    [created_at] => 2020-11-22T16:38:46.000000Z
                    [updated_at] => 2020-11-22T16:38:46.000000Z
                    [alt] => stdClass Object
                        (
                            [en] => 
                        )

                    [fs] => stdClass Object
                        (
                            [org] => /images/page/1/2/phpunittest2.jpg
                            [small] => /images/page/1/2/phpunittest2-small.jpg
                            [medium] => /images/page/1/2/phpunittest2-medium.jpg
                        )
                )
        )
)
PATCH: api/images/position/$direction/$id?token=$token (ustawiamy pozycję obrazka, gdzie $direction: up, down)
stdClass Object
(
    [success] => 1
)
DELETE: api/images/$ids?token=$token (kasujemy obrazeki, gdzie $ids może być wiele id-ków, np.: 1,7,9)
stdClass Object
(
    [success] => 1
)

Klienci:

GET: api/users/clients?token=$token (zwracamy klientów - bez paginacji)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 3
                    [name] => Robert Test
                    [email] => rob@unittest.com
                    [created_at] => 2020-11-22T16:52:28.000000Z
                    [updated_at] => 2020-11-22T16:52:28.000000Z
                )
        )
)
GET: api/clients/$column/$direction?token=$token&search=abc
zwracamy klientów - z paginacją, szukaniem (po name lub email) i sortowaniem, gdzie : $column: id, name, email, created_at, updated_at $direction: asc, desc
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [current_page] => 1
            [data] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 4
                            [name] => Fake Kowalski
                            [email] => sth@abc-example.com
                            [email_verified_at] => 
                            [role] => client
                            [created_at] => 2024-04-01T10:33:02.000000Z
                            [updated_at] => 2024-04-01T10:33:02.000000Z
                        )

                    [1] => stdClass Object
                        (
                            [id] => 3
                            [name] => First Abc Kowalski
                            [email] => fake@example.com
                            [email_verified_at] => 
                            [role] => client
                            [created_at] => 2024-04-01T10:33:02.000000Z
                            [updated_at] => 2024-04-01T10:33:02.000000Z
                        )

                )

            [first_page_url] => http://127.0.0.1:8000/api/clients/id/desc?page=1
            [from] => 1
            [last_page] => 1
            [last_page_url] => http://127.0.0.1:8000/api/clients/id/desc?page=1
            [links] => Array
                (
                    [0] => stdClass Object
                        (
                            [url] => 
                            [label] => « Previous
                            [active] => 
                        )

                    [1] => stdClass Object
                        (
                            [url] => http://127.0.0.1:8000/api/clients/id/desc?page=1
                            [label] => 1
                            [active] => 1
                        )

                    [2] => stdClass Object
                        (
                            [url] => 
                            [label] => Next »
                            [active] => 
                        )

                )

            [next_page_url] => 
            [path] => http://127.0.0.1:8000/api/clients/id/desc
            [per_page] => 10
            [prev_page_url] => 
            [to] => 2
            [total] => 2
        )

)
POST: api/clients/$id?token=$token (dodajemy kienta)
Array
(
    [name] => test client
    [email] => test_client_uniq@cmsrs.pl
    [password] => secretPass123$
    [password_confirmation] => secretPass123$
)

stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [userId] => 5
        )

)

Walidacja:

stdClass Object
(
    [success] => 
    [error] => stdClass Object
        (
            [name] => Array
                (
                    [0] => The name field is required.
                )

            [email] => Array
                (
                    [0] => The email has already been taken.
                )

            [password] => Array
                (
                    [0] => The password must be at least 8 characters.
                    [1] => The password confirmation does not match.
                )
        )
)
PUT: api/clients/$id?token=$token (aktualizujemy klienta - bez możliwości aktualizacji maila)
Array
(
    [name] => test client_new
    [password] => secretPass123$_new
    [password_confirmation] => secretPass123$_new
)

stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [userId] => 5
        )

)
DELETE: api/clients/$id?token=$token (usuwamy klienta)
stdClass Object
(
    [success] => 1
)
GET: api/clients/$id?token=$token (pokazujemy konkretnego klienta)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [id] => 2
            [name] => Robert Test
            [email] => rob@unittest.com
            [email_verified_at] => 
            [role] => client
            [created_at] => 2024-04-04T09:50:48.000000Z
            [updated_at] => 2024-04-04T09:50:48.000000Z
        )
)

Menu nawigacyjne:

POST: api/menus?token=$token (tworzymy menu)
Array
(
    [name] => Array
        (
            [en] => test menu2
        )
)
stdClass Object
(
    [success] => 1
)
GET: api/menus?token=$token (zwracamy menu)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [position] => 1
                    [name] => stdClass Object
                        (
                            [en] => test menu1
                        )
                )
            [1] => stdClass Object
                (
                    [id] => 2
                    [position] => 2
                    [name] => stdClass Object
                        (
                            [en] => test menu2
                        )
                )
        )
)
PUT: api/menus/$id?token=$token (uaktualiamy menu)
Array
(
    [id] => 1
    [name] => Array
        (
            [en] => test menu3 żółta żółć
        )
)
stdClass Object
(
    [success] => 1
)
DELETE: api/menus/$id?token=$token (kasujemy menu)
stdClass Object
(
    [success] => 1
)
PATCH: api/menus/position/$direction/$id?token=$token (ustawiamy pozycję menu, gdzie $direction: up, down)
stdClass Object
(
    [success] => 1
)

Produkty:

POST: api/products?token=$token (tworzymy produkt)
Array
(
    [product_name] => Array
        (
            [en] => php3 db app
        )
    [sku] => AN/34534
    [price] => 123
    [product_description] => Array
        (
            [en] => book desc
        )
    [page_id] => 1
    [images] => Array
        (
            [0] => Array
                (
                    [name] => phpunittest1.jpg
                    [data] => data:image/jpg;base64,/9j/4A.....AFS6G7Jr1PeP/9k=
                    [alt] => Array
                        (
                            [en] => description img1 - product image
                        )
                )
            [1] => Array
                (
                    [name] => phpunittest2.jpg
                    [data] => data:image/jpg;base64,/9j/4AAQSkZ....qaZSCAev/Z
                )
        )
)

stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [productId] => 1
            [data] => stdClass Object
                (
                    [product_name] => stdClass Object
                        (
                            [en] => php3 db app
                        )

                    [sku] => AN/34534
                    [price] => 123
                    [product_description] => stdClass Object
                        (
                            [en] => book desc
                        )

                    [page_id] => 1
                    [images] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [name] => phpunittest1.jpg
                                    [data] => data:image/jpg;base64,/9j/4AAQSkZJ....rAFS6G7Jr1PeP/9k=
                                    [alt] => stdClass Object
                                        (
                                            [en] => description img1 - product image
                                        )
                                )
                            [1] => stdClass Object
                                (
                                    [name] => phpunittest2.jpg
                                    [data] => data:image/jpg;base64,/9j/4AAQSkZJRg....82DVqaZSCAev/Z
                                )
                        )
                )
        )
)
Walidacja:

stdClass Object
(
    [success] => 
    [error] => stdClass Object
        (
            [sku] => Array
                (
                    [0] => The sku has already been taken.
                )
            [price] => Array
                (
                    [0] => The price must be an integer.
                    [1] => The price field is required.
                )
        )
)
stdClass Object
(
    [success] => 
    [error] => stdClass Object
        (
            [product_name] => Duplicate product name: php3 db app (en)
        )
)

GET: api/products?token=$token (zwracamy produkty)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [sku] => AN/34534
                    [price] => 123
                    [page_id] => 1
                    [product_name] => stdClass Object
                        (
                            [en] => php3 db app
                        )

                    [product_description] => stdClass Object
                        (
                            [en] => book desc
                        )

                    [product_name_default_lang] => php3 db app
                    [images] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [id] => 1
                                    [name] => phpunittest1.jpg
                                    [position] => 1
                                    [page_id] => 
                                    [product_id] => 1
                                    [created_at] => 2021-01-20T21:21:36.000000Z
                                    [updated_at] => 2021-01-20T21:21:36.000000Z
                                    [alt] => stdClass Object
                                        (
                                            [en] => description img1 - product image
                                        )

                                    [fs] => stdClass Object
                                        (
                                            [org] => /images/product/1/1/phpunittest1.jpg
                                            [small] => /images/product/1/1/phpunittest1-small.jpg
                                            [medium] => /images/product/1/1/phpunittest1-medium.jpg
                                        )

                                )

                            [1] => stdClass Object
                                (
                                    [id] => 2
                                    [name] => phpunittest2.jpg
                                    [position] => 2
                                    [page_id] => 
                                    [product_id] => 1
                                    [created_at] => 2021-01-20T21:21:36.000000Z
                                    [updated_at] => 2021-01-20T21:21:36.000000Z
                                    [alt] => stdClass Object
                                        (
                                            [en] => 
                                        )

                                    [fs] => stdClass Object
                                        (
                                            [org] => /images/product/1/2/phpunittest2.jpg
                                            [small] => /images/product/1/2/phpunittest2-small.jpg
                                            [medium] => /images/product/1/2/phpunittest2-medium.jpg
                                        )
                                )
                        )
                )
        )
)
GET: api/products/$id?token=$token (pokazujemy konkretny produkt)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [id] => 1
            [published] => 1
            [sku] => AN/34534_1
            [price] => 101
            [page_id] => 1
            [product_name] => stdClass Object
                (
                    [en] => php3 db app_1
                )

            [product_name_slug] => stdClass Object
                (
                    [en] => php3-db-app-1
                )

            [product_description] => stdClass Object
                (
                    [en] => book desc_1
                )

            [product_name_default_lang] => php3 db app_1
            [images] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 1
                            [name] => phpunittest1.jpg
                            [position] => 1
                            [page_id] => 
                            [product_id] => 1
                            [created_at] => 2024-04-25T16:54:10.000000Z
                            [updated_at] => 2024-04-25T16:54:10.000000Z
                            [alt] => stdClass Object
                                (
                                    [en] => description img1 - product image
                                )

                            [fs] => stdClass Object
                                (
                                    [org] => /images/product/1/1/phpunittest1.jpg
                                    [small] => /images/product/1/1/phpunittest1-small.jpg
                                    [medium] => /images/product/1/1/phpunittest1-medium.jpg
                                )

                        )

                    [1] => stdClass Object
                        (
                            [id] => 2
                            [name] => phpunittest2.jpg
                            [position] => 2
                            [page_id] => 
                            [product_id] => 1
                            [created_at] => 2024-04-25T16:54:10.000000Z
                            [updated_at] => 2024-04-25T16:54:10.000000Z
                            [alt] => stdClass Object
                                (
                                    [en] => 
                                )

                            [fs] => stdClass Object
                                (
                                    [org] => /images/product/1/2/phpunittest2.jpg
                                    [small] => /images/product/1/2/phpunittest2-small.jpg
                                    [medium] => /images/product/1/2/phpunittest2-medium.jpg
                                )
                        )
                )
        )
)
PUT: api/products/$id?token=$token (aktualizujemy produkt)
Array
(
    [product_name] => Array
        (
            [en] => PHP7
        )

    [sku] => AN/34534
    [price] => 123
    [product_description] => Array
        (
            [en] => PHP7 - desc
        )

    [page_id] => 1
    [images] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [name] => phpunittest1.jpg
                    [position] => 1
                    [page_id] => 
                    [product_id] => 1
                    [created_at] => 2021-01-20T21:31:20.000000Z
                    [updated_at] => 2021-01-20T21:31:20.000000Z
                    [alt] => Array
                        (
                            [en] => alt1
                        )

                    [fs] => stdClass Object
                        (
                            [org] => /images/product/1/1/phpunittest1.jpg
                            [small] => /images/product/1/1/phpunittest1-small.jpg
                            [medium] => /images/product/1/1/phpunittest1-medium.jpg
                        )

                )

            [1] => Array
                (
                    [id] => 2
                    [name] => phpunittest2.jpg
                    [position] => 2
                    [page_id] => 
                    [product_id] => 1
                    [created_at] => 2021-01-20T21:31:20.000000Z
                    [updated_at] => 2021-01-20T21:31:20.000000Z
                    [alt] => Array
                        (
                            [en] => alt2
                        )

                    [fs] => stdClass Object
                        (
                            [org] => /images/product/1/2/phpunittest2.jpg
                            [small] => /images/product/1/2/phpunittest2-small.jpg
                            [medium] => /images/product/1/2/phpunittest2-medium.jpg
                        )

                )

            [2] => Array
                (
                    [name] => phpunittest2.jpg
                    [data] => data:image/jpg;base64,/9j/4AAQSkZJRgA...VqaZSCAev/Z
                )
        )
)
tylko dla instnejacych zdjęć

Array
(
    [product_name] => Array
        (
            [en] => Update2 img Title
        )

    [sku] => sku/23423
    [price] => 1111
    [page_id] => 1
    [images] => Array
        (
            [0] => Array
                (
                    [id] => 6
                    [alt] => Array
                        (
                            [en] => last
                        )

                    [position] => 202
                )

            [1] => Array
                (
                    [id] => 7
                    [alt] => Array
                        (
                            [en] => first
                        )

                    [position] => 101
                )

            [2] => Array
                (
                    [id] => 8
                    [alt] => Array
                        (
                            [en] => middle
                        )

                    [position] => 155
                )
        )
)
stdClass Object
(
    [success] => 1
)
DELETE: api/products/$id?token=$token (kasujemy produkt)
stdClass Object
(
    [success] => 1
)
GET: api/products/pagination/$lang/$column/$direction?token=$token&search=app_1
zwracamy produkty - z paginacją, szukaniem (po product_name lub sku) i sortowaniem, gdzie : $column: id, published, product_name, page_short_title, sku, price, created_at, updated_at $direction: asc, desc
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [current_page] => 1
            [data] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 1
                            [sku] => AN/34534_1
                            [price] => 101
                            [published] => 1
                            [page_id] => 1
                            [created_at] => 2024-05-07T16:51:24.000000Z
                            [updated_at] => 2024-05-07T16:51:24.000000Z
                            [product_name] => php3 db app_1
                            [page_short_title] => page1
                            [images] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [id] => 1
                                            [name] => phpunittest1.jpg
                                            [position] => 1
                                            [page_id] => 
                                            [product_id] => 1
                                            [created_at] => 2024-05-07T16:51:24.000000Z
                                            [updated_at] => 2024-05-07T16:51:24.000000Z
                                            [alt] => stdClass Object
                                                (
                                                    [en] => description img1 - product image
                                                )
                                            [fs] => stdClass Object
                                                (
                                                    [org] => /images/product/1/1/phpunittest1.jpg
                                                    [small] => /images/product/1/1/phpunittest1-small.jpg
                                                    [medium] => /images/product/1/1/phpunittest1-medium.jpg
                                                )
                                        )
                                    [1] => stdClass Object
                                        (
                                            [id] => 2
                                            [name] => phpunittest2.jpg
                                            [position] => 2
                                            [page_id] => 
                                            [product_id] => 1
                                            [created_at] => 2024-05-07T16:51:24.000000Z
                                            [updated_at] => 2024-05-07T16:51:24.000000Z
                                            [alt] => stdClass Object
                                                (
                                                    [en] => 
                                                )
                                            [fs] => stdClass Object
                                                (
                                                    [org] => /images/product/1/2/phpunittest2.jpg
                                                    [small] => /images/product/1/2/phpunittest2-small.jpg
                                                    [medium] => /images/product/1/2/phpunittest2-medium.jpg
                                                )
                                        )
                                )
                        )
                    [1] => stdClass Object
                        (
                            [id] => 3
                            [sku] => app_1_1
                            [price] => 201
                            [published] => 0
                            [page_id] => 2
                            [created_at] => 2024-05-07T16:51:24.000000Z
                            [updated_at] => 2024-05-07T16:51:24.000000Z
                            [product_name] => php3 db app 2_1
                            [page_short_title] => page2
                            [images] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [id] => 5
                                            [name] => phpunittest1.jpg
                                            [position] => 1
                                            [page_id] => 
                                            [product_id] => 3
                                            [created_at] => 2024-05-07T16:51:24.000000Z
                                            [updated_at] => 2024-05-07T16:51:24.000000Z
                                            [alt] => stdClass Object
                                                (
                                                    [en] => description img1 - product image
                                                )

                                            [fs] => stdClass Object
                                                (
                                                    [org] => /images/product/3/5/phpunittest1.jpg
                                                    [small] => /images/product/3/5/phpunittest1-small.jpg
                                                    [medium] => /images/product/3/5/phpunittest1-medium.jpg
                                                )
                                        )
                                    [1] => stdClass Object
                                        (
                                            [id] => 6
                                            [name] => phpunittest2.jpg
                                            [position] => 2
                                            [page_id] => 
                                            [product_id] => 3
                                            [created_at] => 2024-05-07T16:51:24.000000Z
                                            [updated_at] => 2024-05-07T16:51:24.000000Z
                                            [alt] => stdClass Object
                                                (
                                                    [en] => 
                                                )

                                            [fs] => stdClass Object
                                                (
                                                    [org] => /images/product/3/6/phpunittest2.jpg
                                                    [small] => /images/product/3/6/phpunittest2-small.jpg
                                                    [medium] => /images/product/3/6/phpunittest2-medium.jpg
                                                )
                                        )
                                )
                        )
                )
            [first_page_url] => http://127.0.0.1:8000/api/products/pagination/en/sku/asc?page=1
            [from] => 1
            [last_page] => 1
            [last_page_url] => http://127.0.0.1:8000/api/products/pagination/en/sku/asc?page=1
            [links] => Array
                (
                    [0] => stdClass Object
                        (
                            [url] => 
                            [label] => « Previous
                            [active] => 
                        )

                    [1] => stdClass Object
                        (
                            [url] => http://127.0.0.1:8000/api/products/pagination/en/sku/asc?page=1
                            [label] => 1
                            [active] => 1
                        )

                    [2] => stdClass Object
                        (
                            [url] => 
                            [label] => Next »
                            [active] => 
                        )
                )
            [next_page_url] => 
            [path] => http://127.0.0.1:8000/api/products/pagination/en/sku/asc
            [per_page] => 10
            [prev_page_url] => 
            [to] => 2
            [total] => 2
        )
)

Kontakt:

GET: api/contacts?token=$token (pobieramy wiadomości kontaktowe)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [email] => test@example.com
                    [message] => test message - test1
                    [created_at_format] => 2020-11-23 15:40:14
                )

            [1] => stdClass Object
                (
                    [id] => 2
                    [email] => ja@cmsrs.pl
                    [message] => test2
                    [created_at_format] => 2020-11-23 15:40:14
                )
        )
)
DELETE: api/contacts/$id?token=$token (kasujemy wiadomość kontaktową)
stdClass Object
(
    [success] => 1
)
GET: api/contacts/pagination/$column/$direction?token=$token&search=abc
zwracamy wiadomości kontaktowe - z paginacją, szukaniem (po message lub email) i sortowaniem, gdzie : $column: id, message, email, created_at, updated_at $direction: asc, desc
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [current_page] => 1
            [data] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 2
                            [email] => tt@cmsrs.pl
                            [message] => test contact abc
                            [created_at] => 2024-05-23T11:21:56.000000Z
                            [updated_at] => 2024-05-23T11:21:56.000000Z
                        )

                    [1] => stdClass Object
                        (
                            [id] => 1
                            [email] => abc@cmsrs.pl
                            [message] => test contact message
                            [created_at] => 2024-05-23T11:21:56.000000Z
                            [updated_at] => 2024-05-23T11:21:56.000000Z
                        )

                )

            [first_page_url] => http://127.0.0.1:8000/api/contacts/pagination/id/desc?page=1
            [from] => 1
            [last_page] => 1
            [last_page_url] => http://127.0.0.1:8000/api/contacts/pagination/id/desc?page=1
            [links] => Array
                (
                    [0] => stdClass Object
                        (
                            [url] => 
                            [label] => « Previous
                            [active] => 
                        )

                    [1] => stdClass Object
                        (
                            [url] => http://127.0.0.1:8000/api/contacts/pagination/id/desc?page=1
                            [label] => 1
                            [active] => 1
                        )

                    [2] => stdClass Object
                        (
                            [url] => 
                            [label] => Next »
                            [active] => 
                        )

                )

            [next_page_url] => 
            [path] => http://127.0.0.1:8000/api/contacts/pagination/id/desc
            [per_page] => 10
            [prev_page_url] => 
            [to] => 2
            [total] => 2
        )
)

Ustawienia:

GET: api/config?token=$token (pobieramy wartości konfiguracyjne)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [page_types] => Array
                (
                    [0] => cms
                    [1] => gallery
                    [2] => shop
                    [3] => contact
                    [4] => main_page
                    [5] => privacy_policy
                )

            [langs] => Array
                (
                    [0] => en
                )
            [cache_enable] => 1
            [is_cache_enable] =>
            [default_lang] => en
            [currency] => EUR
            [demo_status] => 
            [is_shop] => 1
        )
)
PUT: api/config/clearcache?token=$token (czyść cache)
stdClass Object
(
    [success] => 1
)
POST: api/config/toggle-cache-enable-file?token=$token (włącz/wyłącz cache_enable_file; if (success == true) => clear cache)
action = 'enable' or 'disable'

Array
(
    [action] => enable
)

stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [value] => 1
            [message] => Cache enabled
        )
)
Walidacja:

stdClass Object
(
    [success] => 
    [error] => stdClass Object
        (
            [toggle_cache_enable_file] => Cache was already enabled
        )
)
GET: api/config/is-cache-enable?token=$token (sprawdz czy jest włączony lub wyłaczony cache; is_cache_enable=cache_enable (in config) && file_exist(cache_enable_file))
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [is_cache_enable] => 
        )
)
PUT: api/config/createsitemap?token=$token (utwórz lub uaktualnij sitemap-e)
stdClass Object
(
    [success] => 1
)

Zamówienia:

GET: api/checkouts?token=$token (pobieramy złożone zamówienia z zawartością koszyka)
stdClass Object
(
    [success] => 1
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [price_total] => 1829
                    [price_deliver] => 14
                    [price_total_add_deliver] => 1843
                    [user_id] => 1
                    [email] => client@cmsrs.pl
                    [first_name] => Jan
                    [last_name] => Kowalski
                    [address] => kolejowa 1 m 2
                    [country] => Polska
                    [city] => Warszawa
                    [telephone] => 1234567123
                    [postcode] => 03-456
                    [is_pay] => 0
                    [created_at] => 2021-06-18T16:20:05.000000Z
                    [baskets] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [qty] => 2
                                    [price] => 112
                                    [product_id] => 1
                                    [product_name] => name11
                                    [product_url] => /cms/books/programmer/name11
                                )

                            [1] => stdClass Object
                                (
                                    [qty] => 5
                                    [price] => 321
                                    [product_id] => 2
                                    [product_name] => name22
                                    [product_url] => /cms/books/programmer/name22
                                )
                        )
                )
        )
)
GET: api/checkouts/pagination/$lang/$column/$direction?token=$token&search=client3 (zwracamy zamówienia - z paginacją, szukaniem (po email) i sortowaniem, gdzie: $column: id, price_total_add_deliver, created_at, updated_at $direction: asc, desc )
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [current_page] => 1
            [data] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 4
                            [price_total] => 3128
                            [price_deliver] => 14
                            [price_total_add_deliver] => 3142
                            [user_id] => 2
                            [email] => client3@cmsrs.pl
                            [first_name] => Jan
                            [last_name] => Kowalski
                            [address] => kolejowa 3 m 2
                            [country] => Polska
                            [city] => Warszawa
                            [telephone] => 1234567123
                            [postcode] => 03-456
                            [is_pay] => 
                            [created_at] => 2024-06-17T12:11:48.000000Z
                            [baskets] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [qty] => 5
                                            [price] => 112
                                            [product_id] => 1
                                            [product_name] => name11
                                            [product_url] => /cms/books/programmer/name11
                                        )

                                    [1] => stdClass Object
                                        (
                                            [qty] => 8
                                            [price] => 321
                                            [product_id] => 2
                                            [product_name] => name22
                                            [product_url] => /cms/books/programmer/name22
                                        )

                                )

                        )

                    [1] => stdClass Object
                        (
                            [id] => 31
                            [price_total] => 14819
                            [price_deliver] => 14
                            [price_total_add_deliver] => 14833
                            [user_id] => 2
                            [email] => client30@cmsrs.pl
                            [first_name] => Jan
                            [last_name] => Kowalski
                            [address] => kolejowa 30 m 2
                            [country] => Polska
                            [city] => Warszawa
                            [telephone] => 1234567123
                            [postcode] => 03-456
                            [is_pay] => 
                            [created_at] => 2024-06-17T12:11:48.000000Z
                            [baskets] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [qty] => 32
                                            [price] => 112
                                            [product_id] => 1
                                            [product_name] => name11
                                            [product_url] => /cms/books/programmer/name11
                                        )

                                    [1] => stdClass Object
                                        (
                                            [qty] => 35
                                            [price] => 321
                                            [product_id] => 2
                                            [product_name] => name22
                                            [product_url] => /cms/books/programmer/name22
                                        )

                                )

                        )

                )

            [first_page_url] => http://127.0.0.1:8000/api/checkouts/pagination/en/price_total_add_deliver/asc?page=1
            [from] => 1
            [last_page] => 1
            [last_page_url] => http://127.0.0.1:8000/api/checkouts/pagination/en/price_total_add_deliver/asc?page=1
            [links] => Array
                (
                    [0] => stdClass Object
                        (
                            [url] => 
                            [label] => « Previous
                            [active] => 
                        )
                    [1] => stdClass Object
                        (
                            [url] => http://127.0.0.1:8000/api/checkouts/pagination/en/price_total_add_deliver/asc?page=1
                            [label] => 1
                            [active] => 1
                        )
                    [2] => stdClass Object
                        (
                            [url] => 
                            [label] => Next »
                            [active] => 
                        )
                )
            [next_page_url] => 
            [path] => http://127.0.0.1:8000/api/checkouts/pagination/en/price_total_add_deliver/asc
            [per_page] => 10
            [prev_page_url] => 
            [to] => 2
            [total] => 2
        )

)

PATCH: api/checkouts/$id?token=$token (aktualizacja kasy w szczególności pole: is_pay)
Array
(
     [is_pay] => 1
)
stdClass Object
(
    [success] => 1
)

Pozostałe API:

GET: api/logout?token=$token (wylogowanie)
stdClass Object
(
    [success] => 1
    [message] => You have successfully logged out.
)