Cart

api/cart endpoint documentation


Get products

Description Returns products for a given cart uuid.
Endpoint url api/cart/products
Method GET
Params
Required
Headers
Name Type Value Description
token string - The token obtained during the account creation call.
Data params
Name Type Value Description
uuid string - Existing for a given account and not expired session's cart uuid
Success response

{
    "code": 200,
    "body": {
        "data": {
            "products": {
                "list": [
                    {
                        "uuid": "3767af21-3050-2f61-a775-eae72956a540",
                        "name": "test product 1",
                        "price": "10.00",
                        "amount": 2
                    }
                ],
                "counter": "1",
                "toPay": {
                    "sum": 20,
                    "currency": "zł"
                }
            },
            "cart": {
                "uuid": "e03954e5-cf59-7d9e-25d0-fc65e9a19c46"
            },
            "session": {
                "uuid": "99404d1b-34a9-6df6-d60f-73f6460e0a96"
            }
        }
    }
}
Error response If given cart_uuid belonging to an expired session given:

{
    "code": 422,
    "body": {
        "data": [],
        "errors": [
            "The given session has expired."
        ]
    }
}

Create cart

Description Creates new cart for a given session.
Endpoint url api/cart/create
Method POST
Params
Required
Headers
Name Type Value Description
token string - The token obtained during the account creation call.
Data params
Name Type Value Description
session_uuid string - Existing for a given account and not expired session identifier
Success response

{
    "code": 200,
    "body": {
        "data": {
            "uuid": "e03954e5-cf59-7d9e-25d0-fc65e9a19c46",
            "session": {
                "uuid": "99404d1b-34a9-6df6-d60f-73f6460e0a96"
            }
        }
    }
}
Error response If wrong/non-existing session_uuid given:

{
    "code": 422,
    "body": {
        "data": [],
        "errors": {
            "session_uuid": [
                "The given session uuid could not be found."
            ]
        }
    }
}

Add product

Description Adds a product to a given cart.
Endpoint url api/cart/product/add
Method POST
Params
Required
Headers
Name Type Value Description
token string - The token obtained during the account creation call.
Data params
Name Type Value Description
cart_uuid string - Existing for a given account cart_uuid belonging to not expired session identifier
product_uuid string - Existing for a given account product identifier
amount int 1-1000
Success response

{
    "code": 200,
    "body": {
        "data": {
            "uuid": "581a2a6d-65b1-6a8b-a5a6-1f2e499b2227",
            "cart": {
                "uuid": "e03954e5-cf59-7d9e-25d0-fc65e9a19c46"
            }
        }
    }
}
Error response If wrong/non-existing session_uuid given:

{
    "code": 422,
    "body": {
        "data": [],
        "errors": {
            "session_uuid": [
                "The given session uuid could not be found."
            ]
        }
    }
}
If the cart has not been created for the given session and(or) given product_uuid does not exist:

{
    "code": 422,
    "body": {
        "data": [],
        "errors": {
            "cart_id": [
                "The given object could not be found."
            ],
            "product_id": [
                "The given object could not be found."
            ]
        }
    }
}

Update product

Description Updates product's amount for the given cart-product assignement.
Endpoint url api/cart/product/update
Method POST
Params
Required
Headers
Name Type Value Description
token string - The token obtained during the account creation call.
Data params
Name Type Value Description
uuid string - Existing cart-product assignement identifier
amount int 1-1000
Success response

{
    "code": 200,
    "body": {
        "data": {
            "uuid": "581a2a6d-65b1-6a8b-a5a6-1f2e499b2227",
            "cart": {
                "uuid": "e03954e5-cf59-7d9e-25d0-fc65e9a19c46"
            }
        }
    }
}
Error response If wrong/non-existing uuid given:

{
    "code": 404,
    "body": {
        "data": [],
        "errors": []
    }
}

Remove product

Description Removes a product from the cart for the given cart-product assignement.
Endpoint url api/cart/product/remove
Method POST
Params
Required
Headers
Name Type Value Description
token string - The token obtained during the account creation call.
Data params
Name Type Value Description
uuid string - Existing cart-product assignement identifier
Success response

{
    "code": 200,
    "body": {
        "data": {
            "uuid": "581a2a6d-65b1-6a8b-a5a6-1f2e499b2227",
            "cart": {
                "uuid": "e03954e5-cf59-7d9e-25d0-fc65e9a19c46"
            }
        }
    }
}
Error response If wrong/non-existing uuid given:

{
    "code": 404,
    "body": {
        "data": [],
        "errors": []
    }
}

https://clickstore.pl © 2018 / Wyklikaj Sklep Bez Pomocy Innych / Przycisk "Kup Teraz" z Koszykiem & Kreator Landing Page w Jednym.