The following methods operate on the Cart data model.
List all carts, or get a cart
GET
http://api.cratejoy.com/v1/carts/
Note: Only carts associated with orders will be returned, a customer must have attempted a checkout
GET
http://api.cratejoy.com/v1/carts/{cart_id}/
Create, get, or delete Cart metadata
These endpoints operate on the Cart metadata subresource.
GET
http://api.cratejoy.com/v1/carts/{cart_id}/metadata/
POST
http://api.cratejoy.com/v1/carts/{cart_id}/metadata/
DELETE
http://api.cratejoy.com/v1/carts/{cart_id}/metadata/
List Carts
GET
http://api.cratejoy.com/v1/carts/
$.ajax({
url: 'https://api.cratejoy.com/v1/carts/',
method: 'GET'
});
{
"count": 1,
"next": null,
"prev": null,
"results": [
{
"completed": true,
"customer_id": 86517999,
"id": 86515947,
"is_test": true,
"order_id": 86518012,
"ship_price": 400,
"store_id": 5340102,
"tax_price": 0,
"tax_rates": [],
"type": "cart",
"url": "/v1/carts/86515947/"
}
]
}
Get Cart
GET
http://api.cratejoy.com/v1/carts/{cart_id}/
$.ajax({
url: 'https://api.cratejoy.com/v1/carts/85497102/',
method: 'GET'
});
{
"completed": true,
"customer_id": 2445749,
"id": 85497102,
"is_test": true,
"order_id": 86518813,
"ship_price": 400,
"store_id": 5340102,
"tax_price": 0,
"tax_rates": [],
"type": "cart"
}
Note: this will only work with carts that have an order associated with them, so the customer has to at least have attempted to checkout.