Magnolia 6.1 reached end of life on March 31, 2021. This branch is no longer supported, see End-of-life policy.
This page describes the cart
endpoint, which can be used to interact with your external e-commerce solution's REST shopping cart service.
With this endpoint, you can:
Creates a cart as an anonymous user.
/.rest/ecommerce/v1/carts/
Parameter | Description | Parameter type | Data type | Connector |
---|---|---|---|---|
| required The definition name. |
|
| commercetools Magento |
connectionName | required The connection name. |
|
| commercetools Magento |
anonymousId | required Identifies the cart belonging to an anonymous user. |
|
| commercetools |
currencyCode | required A three-digit currency code as per ↗ ISO 4217. |
|
| commercetools |
Creates a cart for an anonymous user.
curl -i --user 'superuser:superuser' -H 'anonymousId:anonymous' -F currencyCode=EUR -X POST -H 'Accept:application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts?definitionName=commercetools&connectionName=connection'
Creates an empty cart and quote for a guest and returns the quote ID.
curl -i --user superuser:superuser -X POST -H 'Accept:application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts?definitionName=magento&connectionName=connection'
Creates a cart for a registered user.
/.rest/ecommerce/v1/carts/
Parameter | Description | Parameter type | Data type | Connector |
---|---|---|---|---|
| required The definition name. |
|
| commercetools Magento |
connectionName | required The connection name. |
|
| commercetools Magento |
userId | required commercetools: The unique ID of the user. Magento: Access token. |
|
| commercetools Magento |
currencyCode | required A three-digit currency code as per ↗ ISO 4217. |
|
| commercetools |
Creates a cart for an authenticated user.
curl -i --user superuser:superuser -H 'userId: fe7c3772-f414-426b-8706-083d15c94d29' -H 'Accept: application/json' -F currencyCode=EUR -X POST 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts?definitionName=commercetools&connectionName=connection'
Creates a cart for an authenticated user and returns the quoteId
of the created cart.
curl -i --user superuser:superuser -H 'userId: 5buf20ns1pk7mxqq6v80pft3ug4due1m' -X POST -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts?definitionName=magento&connectionName=connection'
JSON |
---|
53 |
Returns a cart by its ID.
/.rest/ecommerce/v1/carts/{cartId}
Parameter | Description | Parameter type | Data type | Connector |
---|---|---|---|---|
| required commercetools: The unique ID of the cart. Magento: quote ID. |
|
| commercetools Magento (anonymous) |
definitionName | required The definition name |
|
| commercetools Magento |
connectionName | required The connection name |
|
| commercetools Magento |
Gets a cart by its ID (for both anonymous and authenticated users).
curl -i --user superuser:superuser -X GET -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/060c8a1d-ef13-4208-9723-96e574e611b0?definitionName=commercetools&connectionName=connection'
Get a cart by its quote ID for anonymous users. For authenticated users, use get by user ID.
curl -i --user superuser:superuser -X GET -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/64c32568be8c837cf9930149592c3c16?definitionName=magento&connectionName=connection'
Returns a cart by user ID.
/.rest/ecommerce/v1/carts/user
Parameter | Description | Parameter type | Data type | Connector |
| required commercetools: the unique ID of the user. Magento: the Access token. |
|
| commercetools Magento |
definitionName | required The definition name. |
|
| commercetools Magento |
connectionName | required The connection name. |
|
| commercetools Magento |
Returns a cart by user ID.
curl -i --user superuser:superuser -X GET -H 'Accept: application/json' -H 'userId: fe7c3772-f414-426b-8706-083d15c94d29' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/user?definitionName=commercetools&connectionName=connection'
Returns a cart by user access token.
curl -i --user superuser:superuser -X GET -H 'Accept: application/json' -H 'userId: tdsxx5miep5pc6ihq8elk7gp83jfg883' 'http://localhost:8080/magnoliuthor/.rest/ecommerce/v1/carts/user?definitionName=magento&connectionName=connection'
Adds an item to a cart.
/.rest/ecommerce/v1/carts/items
Parameter | Description | Parameter type | Data type | Connector |
productId | required commercetools: the unique ID of the product. Magento: SKU of the product. |
|
| commercetools Magento |
| required in commercetools, o nly for anonymous in Magento The unique ID of the cart. |
|
| commercetools Magento |
quantity | required , default is 1 Quantity of products added to the cart. |
|
| commercetools Magento |
quoteId | required The quote id. |
|
| Magento |
definitionName | required The definition name. |
|
| commercetools Magento |
connectionName | required The connection name. |
|
| commercetools Magento |
accessToken | required The access token. |
|
| Magento |
Adds an item to a cart.
curl -i --user superuser:superuser -F cartId=d459f9f3-c067-481f-a446-10d1c24157a6 -F productId=84e64c7c-7f98-4a1c-af4a-e8cc2b7f483c -F quantity=5 -X POST -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items?definitionName=commercetools&connectionName=connection'
Adds an item to a cart for an anonymous user.
curl -i --user superuser:superuser -F cartId=179 -F productId=24-MB02 -F quantity=5 -F quoteId=39221e4d2830caf22f83da7a0138a393 -X POST -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items?definitionName=magento&connectionName=connection'
Adds an item to a cart for an authenticated user.
curl -i --user superuser:superuser -H 'accessToken: sv72pa2wn92k8m81609g8i84s7mpe7ym' -F productId=24-MB02 -F quantity=5 -F quoteId=12 -X POST -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items?connectionName=connection&definitionName=magento'
Changes the quantity of items in a cart.
/.rest/ecommerce/v1/carts/items/{itemId}
Parameter | Description | Parameter type | Data type | Connector |
itemId | required The ID of an item in a cart. |
|
| commercetools Magento |
| required in commercetools, only for anonymous in Magento The unique ID of the cart. |
|
| commercetools Magento |
quantity | required New quantity of products in the cart. |
|
| commercetools Magento |
quoteId | required The quote ID. |
|
| Magento |
definitionName | required The definition name. |
|
| commercetools Magento |
connectionName | required The connection name. |
|
| commercetools Magento |
accessToken | required for authenticated users The access token. |
|
| Magento |
Changes the quantity of items in a cart.
curl -i --user superuser:superuser -F quantity=10 -F cartId=6e1ffa9c-2f47-47e3-8b21-93e0b31f86c3 -X POST -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items/252ca4db-334b-460e-b372-be9694d8e1eb?definitionName=commercetools&connectionName=connection'
Changes the quantity of items in a cart (anonymous user).
curl -i --user superuser:superuser -F qouteId=af619e70d4d03ecc362b8ae4ac7e308f -F quantity=10 -F cartId=119 -X POST -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items/103?definitionName=magento&connectionName=connection'
Changes the quantity of items in a cart (authenticated user).
curl -i --user superuser:superuser -H 'accessToken: sv72pa2wn92k8m81609g8i84s7mpe7ym' -F qouteId=12 -F quantity=10 -X POST -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items/52?definitionName=magento&connectionName=connection'
{"item_id":52,"sku":"24-MB02","qty":10,"name":"Fusion Backpack","price":59,"product_type":"simple","quote_id":"12"}
Removes an item from a cart.
/.rest/ecommerce/v1/carts/items/{itemId}
Parameter | Description | Parameter type | Data type | Connector |
itemId | required ID of an item in the cart. |
|
| commercetools Magento |
| required The unique ID of the cart. |
|
| commercetools |
definitionName | required The definition name. |
|
| commercetools Magento |
connectionName | required The connection name. |
|
| commercetools Magento |
accessToken | required The access token. |
|
| Magento - authenticated cart |
quoteId | required The quote id. | form | string | Magento - anonymous |
Removes an item from a cart.
curl -i --user superuser:superuser -X DELETE -H 'Accept: application/json' -F cartId=d459f9f3-c067-481f-a446-10d1c24157a6 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items/dc68f18f-d101-4d57-a74d-7f070f496b10?definitionName=commercetools&connectionName=connection'
Removes an item from a cart (anonymous).
curl -i --user superuser:superuser -X DELETE -H 'Accept: application/json' -F quoteId=db24b082c0007eeddf72d4359e6d4cc2 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items/159?definitionName=magento&connectionName=connection'
Removes an item from a cart (authenticated).
curl -i --user superuser:superuser -H 'accessToken: sv72pa2wn92k8m81609g8i84s7mpe7ym' -X DELETE -H 'Accept: application/json' 'http://localhost:8080/magnoliaAuthor/.rest/ecommerce/v1/carts/items/52?definitionName=magento&connectionName=connection'