REST API

Below I show some examples requests and responses

Endpoints that not require authorization:

POST: api/login (login)
Array
(
    [email] => test@email.com
    [password] => cmsrs
)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [token] => eyJ0eXAiOiJK...7nhyflrqY-xA
        )
)
POST: api/comments/$pageId (create comments)
Array
(
    [content] => test comment - test123
)
stdClass Object
(
    [success] => 1
)
GET: api/comments/$pageId (read comments)
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 (create a contact message)
Array
(
    [email] => test@example.com
    [message] => test message - test123
)
stdClass Object
(
    [success] => 1
    [message] => Thank you for using the contact form
)
GET: api/page/$pageId/$lang (get page)
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] => 
                        )
                )
        )
)

Endpoints that require authorization:

GET: api/logout?token=$token (logout)
stdClass Object
(
    [success] => 1
    [message] => You have successfully logged out.
)
POST: api/pages?token=$token (create page)
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 (read pages)
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?token=$token (get page by Id)
stdClass Object
(
    [success] => 1
    [data] => stdClass Object
        (
            [id] => 1
            [published] => 1
            [commented] => 1
            [after_login] => 0
            [position] => 1
            [type] => cms
            [menu_id] => 
            [page_id] => 
            [title] => stdClass Object
                (
                    [en] => page 1 test
                )

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

            [description] => stdClass Object
                (
                    [en] => this page: test desc ...
                )

            [content] => stdClass Object
                (
                    [en] => content test133445
                )

            [images] => Array
                (
                )
        )
)
PUT: api/pages/$id?token=$token (update page)
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
                )
        )
)
stdClass Object
(
    [success] => 1
)
DELETE: api/pages/$id?token=$token (delete page)
stdClass Object
(
    [success] => 1
)
GET: api/pages/position/$direction/$id?token=$token (set page posittion, where $direction: up, down)
stdClass Object
(
    [success] => 1
)
GET: api/pages/type/$type (get pages base on type, where $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
                        (
                        )
                )
        )
)
GET: api/images/$type/$pageId?token=$token (get images, where $type: page, product)
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
                        )
                )
        )
)
GET: api/images/position/$direction/$id?token=$token (set image position, where $direction: up, down)
stdClass Object
(
    [success] => 1
)
DELETE: api/images/$id?token=$token (delete image)
stdClass Object
(
    [success] => 1
)
GET: api/users/clients?token=$token (get clients)
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
                )
        )
)
POST: api/menus?token=$token (create menu)
Array
(
    [name] => Array
        (
            [en] => test menu2
        )
)
stdClass Object
(
    [success] => 1
)
GET: api/menus?token=$token (get menus)
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 (update menu)
Array
(
    [id] => 1
    [name] => Array
        (
            [en] => test menu3 żółta żółć
        )
)
stdClass Object
(
    [success] => 1
)
DELETE: api/menus/$id?token=$token (delete menu)
stdClass Object
(
    [success] => 1
)
GET: api/menus/position/$direction}/$id?token=$token (set menu posittion, where $direction: up, down)
stdClass Object
(
    [success] => 1
)
POST: api/products?token=$token (create product)
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
                                )
                        )
                )
        )
)
GET: api/products?token=$token (get products)
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
                                        )
                                )
                        )
                )
        )
)
PUT: api/products/$id?token=$token (update product)
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
                )
        )
)
stdClass Object
(
    [success] => 1
)
DELETE: api/products/$id?token=$token (delete product)
stdClass Object
(
    [success] => 1
)
GET: api/contacts?token=$token (get contact messages)
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 (delete contact message)
stdClass Object
(
    [success] => 1
)
GET: api/config?token=$token (get config values)
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
        )
)
GET: api/checkouts?token=$token (we collect orders placed with the contents of the basket)
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
                                )
                        )
                )
        )
)
PUT: api/checkouts/$id?token=$token (checkout update, in particular the is_pay field)
Array
(
     [is_pay] => 1
)
stdClass Object
(
    [success] => 1
)