REST API Shopping cart
Logic Shopcart for any platform.
Faster
You will use very fastest technologies. This is docker image to run the nginx.
Fool-proof
Image size: 8 MB.
Low-priced
Amazing software for the low price of FREE!
You will use very fastest technologies. This is docker image to run the nginx.
Image size: 8 MB.
Amazing software for the low price of FREE!
$ docker pull imega/cart
$ docker run -d --env REDIS_IP={YOUR_REDIS} --env REDIS_PORT=6379 -p 80:8085 imega/cart
Get the details from the basket is easy.
200: Ok
404: basket is not exist.
$http.get('http://shopcart.imega.ru/cart/' + this.currentUuid).then(
function (res) {
console(res.data);
}
);
curl http://shopcart.imega.ru/cart/{cartUUID}
As well as the previous example, further specify the ID of product.
200: Ok
404: product is not exist.
$http.get('http://shopcart.imega.ru/cart/' + this.currentUuid + '/' + productUuid).then(
function (res) {
console(res.data);
}
);
curl http://shopcart.imega.ru/cart/{cartUUID}/{productUUID}
After creating a product you get HTTP 201 response code and a link to create a product (Header: Location)
201: Added product
409: Conflict, product is exist.
$http.put('http://shopcart.imega.ru/cart', {
price: product.price,
title: product.title,
preview: product.url,
quantity: 1,
url: product.url,
cart_uuid: this.currentUuid,
product_id: product.product_id
}).then(
function (res) {
console.log(res);
}
);
curl -X PUT -d '"{
"cart_uuid": "a727cbf0-d165-4703-bf57-3a8af0b83cbd",
"product_id": "6126f97c-29fe-4be4-94df-4e3677d7b129",
"title": "iPhone 6S 16Gb",
"price": 749,
"preview": "http://example.com/url_to_image_preview.png",
"quantity": 1,
"url": "http://example.com/url_to_page_detail_product"
}"' http://shopcart.imega.ru/cart/
200: Ok
404: product is not exist.
$http.post(
'http://shopcart.imega.ru/cart/',
{
price: product.price,
title: product.title,
preview: product.url,
quantity: Number(product.quantity),
url: product.url,
cart_uuid: this.currentUuid,
product_id: product.product_id
}
);
curl -X POST -d '"{
"cart_uuid": "a727cbf0-d165-4703-bf57-3a8af0b83cbd",
"product_id": "6126f97c-29fe-4be4-94df-4e3677d7b129",
"title": "iPhone 6S 16Gb",
"price": 749,
"preview": "http://example.com/url_to_image_preview.png",
"quantity": 1,
"url": "http://example.com/url_to_page_detail_product"
}"' http://shopcart.imega.ru/cart/
200: Ok
404: product is not exist.
$http.delete('http://shopcart.imega.ru/cart/' + this.currentUuid + '/' + product.product_id);
curl -X DELETE http://shopcart.imega.ru/cart/{cartUUID}/{productUUID}
{
"cart_uuid": "a727cbf0-d165-4703-bf57-3a8af0b83cbd",
"product_id": "6126f97c-29fe-4be4-94df-4e3677d7b129",
"title": "iPhone 6S 16Gb",
"price": 749,
"preview": "http://example.com/url_to_image_preview.png",
"quantity": 1,
"url": "http://example.com/url_to_page_detail_product"
}