Related Documents
Document Properties
Kbid25E185
Last Modified23-Jun-2020
Added to KB24-Sep-2013
Public AccessEveryone
StatusOnline
Doc TypeReferences
ProductICM 7.6

REST API - Add to Cart (valid from 7.4 to 7.6)

URI

/baskets/<basket-id>/items

Http Method

POST

Short Description

Adds a list of items to an existing cart.

Query Parameters

none

Example Requests

/baskets/XkoKDACqjEkAAAFCHClCMC0h/items/

HTTP Status Codes

200 ОК

400 Bad Request
       Possible values for header 'error-key':

    • basket.basket_id_required.error
    • basket.gift.message.to_required.error
    • basket.gift.message.from_required.error
    • basket.gift.message.message_required.error
    • basket.product.add_to_basket_unsuccessful.error
    • basket.product.not_found.error
    • basket.product.sku_required.error
    • basket.product.quantity_invalid.error

404 Not Found
       Possible values for header 'error-key':

    • basket.basket_not_found.error
    • basket.product.not_found.error

Description

Adds a list of items to the basket. For every item sku and quantity has to be specified. For gift certificates additional information are required. That's recipient email, recipient name, sender email, sender name and greeting message.

If basket is not found, a status code 404 is returned as a response. If any error occurs when adding products to the basket, then a status code 400 is returned.

Cartridge

app_sf_rest

Application

B2C Web Shop, SMB Web Shop

Product Version

7.4

Product To Version

7.6

Status

final

JSON

Request Data Format

application/json

Request related java object

com.intershop.sellside.rest.common.capi.resource.basket.BasketLineItemResource
com.intershop.sellside.rest.common.capi.resourceobject.basket.LineItemCollectionRO
com.intershop.sellside.rest.common.capi.resourceobject.basket.BasketLineItemRO

Request Example

{
    "elements":
    [
        {
            "sku":"3934150",
            "quantity": {
                "value": 1
            }
        },
        {
            "sku":"859910",
            "quantity": {
                "value": 2
            }
        },
        {
            "sku":"4776790",
            "quantity": {
                "value": 3
            }
        },
        {
            "sku":"GiftCertificate10",
            "senderName":"Patricia",
            "senderEmail":"patricia@test.intershop.de",
            "recipientName":"Charles",
            "recipientEmail":"charles@test.intershop.de",
            "greetingMessage":"Greeting message !!!",
            "quantity": {
                "value": 1
            }
        }
    ]
}

Response Data Format

application/json

Response related java object

com.intershop.sellside.rest.common.capi.resource.basket.BasketLineItemResource
com.intershop.component.rest.capi.resourceobject.LinkRO

Response Example

{
    "type": "Link",
    "uri": "PrimeTech-PrimeTechSpecials-Site/-/baskets/XkoKDACqjEkAAAFCHClCMC0h/items"
}

XML

XML Request Data Format

text/xml

XML Request Java Objects

com.intershop.sellside.rest.common.capi.resource.basket.BasketLineItemResource
com.intershop.sellside.rest.common.capi.resourceobject.basket.LineItemCollectionRO
com.intershop.sellside.rest.common.capi.resourceobject.basket.BasketLineItemRO

XML Request Example

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LineItems>
    <elements>
        <BasketLineItem>
            <sku>3934150</sku>
            <quantity type="Quantity">
                <value>1</value>
            </quantity>            
        </BasketLineItem>
        <BasketLineItem>
            <sku>859910</sku>
            <quantity type="Quantity">
                <value>2</value>
            </quantity>            
        </BasketLineItem>
        <BasketLineItem>
            <sku>4776790</sku>
            <quantity type="Quantity">
                <value>3</value>
            </quantity>            
        </BasketLineItem>
        <BasketLineItem>
            <sku>GiftCertificate10</sku>
            <quantity type="Quantity">
                <value>1</value>
            </quantity>        
            <recipientEmail>charles@test.intershop.de</recipientEmail>
            <recipientName>Charles</recipientName>
            <senderEmail>patricia@test.intershop.de</senderEmail>
            <senderName>Patricia</senderName>            
            <greetingMessage>Greeting message !!!</greetingMessage>
        </BasketLineItem>
    </elements>
</LineItems>

XML Response Data Format

text/xml

XML Response Java Objects

com.intershop.sellside.rest.common.capi.resource.basket.BasketLineItemResource
com.intershop.component.rest.capi.resourceobject.LinkRO

XML Response Example

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Link type="Link">
    <uri>PrimeTech-PrimeTechSpecials-Site/-/baskets/XkoKDACqjEkAAAFCHClCMC0h/items</uri>
</Link>

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Tickets