Related Documents
Document Properties
Kbid24446F
Last Modified23-Jun-2020
Added to KB04-Jun-2013
Public AccessEveryone
StatusOnline
Doc TypeReferences

REST API - Set basket related information (until 7.4 CI)

URI

/baskets/<basket-id>

Http Method

PUT

Short Description

Sets/updates basket related data.

Query Parameters

none

Example Requests

/baskets/XkoKDACqjEkAAAFCHClCMC0h

HTTP Status Codes


200 OK

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

    • basket.address_not_found.error
    • basket.basket_id_required.error
    • basket.invalid_address.error
    • customer.address.missing_fields.error

401 Unauthorized

403 Forbidden
Possible values for header 'error-key':

    • basket.login_required.error
    • basket.wrong_basket_id.error

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

    • basket.basket_not_found.error


Description


Sets following basket related data:

Common ship-to address

Sets the ship-to address for all line items of the basket.
If a complete address is specified, this address set after validation successfully finished. If user is logged in and the ID of an address of user's profile is specified, the address with this ID is set.

Invoice-to address

Sets the invoice-to address for all line items of the basket.
If a complete address is specified, this address set after validation successfully finished. If user is logged in and the ID of an address of user's profile is specified, the address with this ID is set.

Promotion code

Adds one ore more promotion code(s) to the basket. If the specified promotion code is valid, it is applied to the basket. If the promotion code is not valid, no promotion is applied. There is no validation result yet.

DepartmentOption to set the buyer's department at the basket in case of unregistered checkout.
Taxation IDOption to set buyer's taxation ID at the basket in case of unregistered checkout.
External order reference IDOption to set a buyer specific order reference ID at the basket.
Owning user

Assigns the basket to another user. It is intended to be used to transfer the basket of an anonymous user to a registered user, when the anonymous user logs-in during the checkout. In order to change the owner a valid authentication token of the new user has to be applied.

After changing the owner, the current user has no access to this basket anymore!

Cartridge

app_sf_rest

Application

B2C Web Shop, SMB Web Shop

Product Version

7.4

Product To Version

7.4.6

Status

final

JSON

Request Data Format

application/json

Request related java object

com.intershop.sellside.rest.common.capi.resource.basket.BasketResource
com.intershop.sellside.rest.common.capi.resourceobject.basket.BasketRO

Request Example


Set shipping address:
As anonymous user:

{ 
	"commonShipToAddress" : { 
		"title" : "Mrs.", 
		"firstName" : "Patricia", 
		"lastName" : "Miller", 
		"postalCode" : "14482", 
		"email" : "patricia@test.intershop.de", 
		"street" : "Berliner Str. 20", 
		"state" : "Brandenburg", 
		"country" : "Germany", 
		"countryCode" : "DE", 
		"city" : "Potsdam" 
	} 
 }

or for registered users if the address has already been entered:

{ 
	"commonShipToAddress" : { 
		"id":"Xf7AqMgoyuMAAAEs2sx0Uei" 
	} 
 }

Set invoice address:
As anonymous user:

{
    "invoiceToAddress": {
        "type": "Address",
        "state": "",
        "country": "Germany",
        "city": "Potsdam",
        "street": "Berliner Str. 20",
        "street2": "",
        "street3": "",
        "mobile": "",
        "phoneHome": "049364112677",
        "firstName": "Patricia",
        "lastName": "Miller",
        "title": "Mrs.",
        "countryCode": "DE",
        "postalCode": "14482",
        "phoneBusiness": "",
        "email": "patricia@test.intershop.de",
        "addressName": "Patricia Miller, Berliner Str. 20, Potsdam"
    }
}

or for registered users if the address has already been entered:

{
    "invoiceToAddress": {
        "id": "5DIKDACqvgwAAAFCptVTzDKI"
    }
}

Set promotion code

{
	"promotions" : 
	[
		{ "code" : "INTERSHOP" }
	]
}

Set department

{
	"department" : "Sales"
}

Set external order reference ID

{
	"externalOrderReferenceID" : "30000008899"
}

Set taxation ID

{
	"taxationID" : "0123456789"
}

Set new owner

{
	"newOwnerAuthenticationToken" : "standard@PBEWithMD5AndTripleDES:TCgGG/e9XL0=|Peb5Ipb5W/R+nq0Yk7GiKpf6FiKeC7yAAx9eCd6UP8N3VyGfKs/6XA=="
}




Response Data Format

application/json

Response related java object

com.intershop.sellside.rest.common.capi.resourceobject.basket.BasketRO

Response Example

{
   "name": "basket",
   "type": "Basket",
   "id": "dFvAqAJmZ48AAAFDF1Eq3B6S",
   "department": "Sales",
   "taxationID": "0123456789",
   "invoiceToAddress":
   {
       "type": "Address",
       "id": "yWYKABvH_2MAAAFCBFUJoPk3",
       "country": "Germany",
       "city": "Potsdam",
       "postalCode": "14482",
       "street": "Berliner Str. 20",
       "phoneHome": "049364112677",
       "firstName": "Patricia",
       "lastName": "Miller",
       "title": "Mrs.",
       "addressName": "Patricia Miller, Berliner Str. 20, Potsdam",
       "countryCode": "DE"
   },
   "externalOrderReferenceID": "30000008899",
   "shippingBuckets":
   [
       {
           "name": "basketShippingBucket",
           "type": "BasketShippingBucket",
           "shippingMethod":
           {
               "name": "Standard Ground",
               "type": "BasketShippingMethod",
               "id": "STD_GROUND",
               "shippingTimeMin": 3,
               "shippingTimeMax": 7
           },
           "lineItems":
           [
               {
                   "type": "Link",
                   "title": "Asus K72 series K72F-TY011V",
                   "uri": "PrimeTech-PrimeTechSpecials-Site/b2c-web-shop/baskets/dFvAqAJmZ48AAAFDF1Eq3B6S/items/D9LAqAJmmP0AAAFDbSwq3B6V",
                   "attributes":
                   [
                       {
                           "name": "position",
                           "type": "Integer",
                           "value": 2
                       },
                       {
                           "name": "sku",
                           "type": "String",
                           "value": "4776790"
                       }
                   ]
               }
           ]
       },
       {
           "name": "basketShippingBucket",
           "type": "BasketShippingBucket",
           "shippingMethod":
           {
               "name": "Standard Freight Delivery",
               "type": "BasketShippingMethod",
               "id": "TRUCK",
               "shippingTimeMin": 5,
               "shippingTimeMax": 7
           },
           "lineItems":
           [
               {
                   "type": "Link",
                   "title": "LG 32LE3300",
                   "uri": "PrimeTech-PrimeTechSpecials-Site/b2c-web-shop/baskets/dFvAqAJmZ48AAAFDF1Eq3B6S/items/KorAqAJmfzUAAAFDlyEq3B6U",
                   "attributes":
                   [
                       {
                           "name": "position",
                           "type": "Integer",
                           "value": 1
                       },
                       {
                           "name": "sku",
                           "type": "String",
                           "value": "4555724"
                       }
                   ]
               }
           ]
       }
   ],
   "purchaseCurrency": "USD",
   "totals":
   {
       "name": "basketTotals",
       "type": "BasketTotals",
       "basketTotal":
       {
           "type": "Money",
           "value": 2603.47,
           "currencyMnemonic": "USD"
       },
       "taxTotal":
       {
           "type": "Money",
           "value": 147.37,
           "currencyMnemonic": "USD"
       },
       "dutiesAndSurchargesTotal":
       {
           "type": "Money",
           "value": 0,
           "currencyMnemonic": "USD"
       },
       "shippingTotal":
       {
           "type": "Money",
           "value": 142.78,
           "currencyMnemonic": "USD"
       },
       "itemTotal":
       {
           "type": "Money",
           "value": 2614.07,
           "currencyMnemonic": "USD"
       },
       "itemShippingRebatesTotal":
       {
           "type": "Money",
           "value": 0,
           "currencyMnemonic": "USD"
       },
       "bucketShippingRebatesTotal":
       {
           "type": "Money",
           "value": 0,
           "currencyMnemonic": "USD"
       },
       "basketShippingRebatesTotal":
       {
           "type": "Money",
           "value": -142.78,
           "currencyMnemonic": "USD"
       },
       "basketValueRebatesTotal":
       {
           "type": "Money",
           "value": -10.6,
           "currencyMnemonic": "USD"
       }
   },
   "salesTaxTotalsByTaxRate":
   [
       {
           "name": "name",
           "type": "AppliedTax",
           "amount":
           {
               "type": "Money",
               "value": 147.37,
               "currencyMnemonic": "USD"
           },
           "rate": 6
       }
   ],
   "valueRebates":
   [
       {
           "name": "appliedRebate",
           "type": "AppliedRebate",
           "description": "For orders over 200 USD, a 10 USD Order discount is guaranteed for the Promo Code "INTERSHOP".",
           "code": "INTERSHOP",
           "amount":
           {
               "type": "Money",
               "value": -10.6,
               "currencyMnemonic": "USD"
           },
           "rebateType": "OrderValueOffDiscount"
       }
   ],
   "shippingRebates":
   [
       {
           "name": "appliedRebate",
           "type": "AppliedRebate",
           "description": "For LED TVs the shipping is free.",
           "amount":
           {
               "type": "Money",
               "value": -142.78,
               "currencyMnemonic": "USD"
           },
           "rebateType": "ShippingPercentageOffDiscount"
       }
   ]
}

XML

XML Request Data Format

text/xml

XML Request Java Objects

com.intershop.sellside.rest.common.capi.resource.basket.BasketResource
com.intershop.sellside.rest.common.capi.resourceobject.basket.BasketRO

XML Request Example


Set shipping address:
As anonymous user:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <commonShipToAddress type="Address">
        <addressName>Patricia Miller, Berliner Str. 20, Potsdam</addressName>
        <city>Potsdam</city>
        <country>Germany</country>
        <countryCode>DE</countryCode>
        <email>patricia@test.intershop.de</email>
        <firstName>Patricia</firstName>
        <ID>kS4KABvHkwcAAAFCdL4J6CtB</ID>
        <lastName>Miller</lastName>
        <mobile>004917623412341</mobile>
        <phoneBusiness>004915163412341</phoneBusiness>
        <phoneHome>049364112677</phoneHome>
        <postalCode>14482</postalCode>
        <state>BER</state>
        <street>Berliner Str.</street>
        <street2>20</street2>
        <street3>Downtown</street3>
        <title>Mrs.</title>
    </commonShipToAddress >   
</Basket> 

or for registered users if the address has already been entered:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <commonShipToAddress type="Address">      
        <ID>5DIKDACqvgwAAAFCptVTzDKI</ID>
    </commonShipToAddress>   
</Basket> 

Set invoice address:
As anonymous user:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <invoiceToAddress type="Address">
        <addressName>Patricia Miller, Berliner Str. 20, Potsdam</addressName>
        <city>Potsdam</city>
        <country>Germany</country>
        <countryCode>DE</countryCode>
        <email>patricia@test.intershop.de</email>
        <firstName>Patricia</firstName>
        <ID>kS4KABvHkwcAAAFCdL4J6CtB</ID>
        <lastName>Miller</lastName>
        <mobile>004917623412341</mobile>
        <phoneBusiness></phoneBusiness>
        <phoneHome>049364112677</phoneHome>
        <postalCode>14482</postalCode>
        <state>BER</state>
        <street>Berliner Str. 20</street>
        <street2>20</street2>
        <street3>Downtown</street3>
        <title>Mrs.</title>
    </invoiceToAddress>   
</Basket>

or for registered users if the address has already been entered:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <invoiceToAddresstype="Address">      
        <ID>5DIKDACqvgwAAAFCptVTzDKI</ID>
    </invoiceToAddress>   
</Basket> 

Set promotion code

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <promotions>
        <PromotionLink type="PromotionLink">
            <code>INTERSHOP</code>
        </PromotionLink>
    </promotions>    
</Basket>

Set department

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <department>Sales</department>
</Basket>

Set external order reference ID

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <externalOrderReferenceID>30000008899</externalOrderReferenceID>
</Basket>

Set taxation ID

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <taxationID>9181081508155</taxationID>
</Basket>

Set new owner

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
	<newOwnerAuthenticationToken>standard@PBEWithMD5AndTripleDES:TCgGG/e9XL0=|Peb5Ipb5W/R+nq0Yk7GiKpf6FiKeC7yAAx9eCd6UP8N3VyGfKs/6XA==</newOwnerAuthenticationToken>
</Basket>

XML Response Data Format

text/xml

XML Response Java Objects

com.intershop.sellside.rest.common.capi.resourceobject.basket.BasketRO

XML Response Example

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Basket name="basket" type="Basket">
    <department>Sales</department>
    <externalOrderReferenceID>30000008899</externalOrderReferenceID>
    <id>dFvAqAJmZ48AAAFDF1Eq3B6S</id>
    <invoiceToAddress type="Address">
        <addressName>Patricia Miller, Berliner Str. 20, Potsdam</addressName>
        <city>Potsdam</city>
        <country>Germany</country>
        <countryCode>DE</countryCode>
        <firstName>Patricia</firstName>
        <id>yWYKABvH_2MAAAFCBFUJoPk3</id>
        <lastName>Miller</lastName>
        <phoneHome>049364112677</phoneHome>
        <postalCode>14482</postalCode>
        <street>Berliner Str. 20</street>
        <title>Mrs.</title>
    </invoiceToAddress>
    <purchaseCurrency>USD</purchaseCurrency>
    <salesTaxTotalsByTaxRate>
        <AppliedTax name="name" type="AppliedTax">
            <amount type="Money">
                <currencyMnemonic>USD</currencyMnemonic>
                <value>147.37</value>
            </amount>
            <rate>6.0</rate>
        </AppliedTax>
    </salesTaxTotalsByTaxRate>
    <shippingBuckets>
        <BasketShippingBucket name="basketShippingBucket" type="BasketShippingBucket">
            <lineItems>
                <Link type="Link">
                    <attributes>
                        <ResourceAttribute name="position" type="Integer">
                            <value>2</value>
                        </ResourceAttribute>
                        <ResourceAttribute name="sku" type="String">
                            <value>4776790</value>
                        </ResourceAttribute>
                    </attributes>
                    <title>Asus K72 series K72F-TY011V</title>
                    <uri>PrimeTech-PrimeTechSpecials-Site/b2c-web-shop/baskets/dFvAqAJmZ48AAAFDF1Eq3B6S/items/D9LAqAJmmP0AAAFDbSwq3B6V</uri>
                </Link>
            </lineItems>
            <shippingMethod name="Standard Ground" type="BasketShippingMethod">
                <id>STD_GROUND</id>
                <shippingTimeMax>7</shippingTimeMax>
                <shippingTimeMin>3</shippingTimeMin>
            </shippingMethod>
        </BasketShippingBucket>
        <BasketShippingBucket name="basketShippingBucket" type="BasketShippingBucket">
            <lineItems>
                <Link type="Link">
                    <attributes>
                        <ResourceAttribute name="position" type="Integer">
                            <value>1</value>
                        </ResourceAttribute>
                        <ResourceAttribute name="sku" type="String">
                            <value>4555724</value>
                        </ResourceAttribute>
                    </attributes>
                    <title>LG 32LE3300</title>
                    <uri>PrimeTech-PrimeTechSpecials-Site/b2c-web-shop/baskets/dFvAqAJmZ48AAAFDF1Eq3B6S/items/KorAqAJmfzUAAAFDlyEq3B6U</uri>
                </Link>
            </lineItems>
            <shippingMethod name="Standard Freight Delivery" type="BasketShippingMethod">
                <id>TRUCK</id>
                <shippingTimeMax>7</shippingTimeMax>
                <shippingTimeMin>5</shippingTimeMin>
            </shippingMethod>
        </BasketShippingBucket>
    </shippingBuckets>
    <shippingRebates>
        <AppliedRebate name="appliedRebate" type="AppliedRebate">
            <rebateType>ShippingPercentageOffDiscount</rebateType>
        </AppliedRebate>
    </shippingRebates>
    <taxationID>0123456789</taxationID>
    <totals name="basketTotals" type="BasketTotals">
        <basketShippingRebatesTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>-142.78</value>
        </basketShippingRebatesTotal>
        <basketTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>2603.47</value>
        </basketTotal>
        <basketValueRebatesTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>-10.60</value>
        </basketValueRebatesTotal>
        <bucketShippingRebatesTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>0.0</value>
        </bucketShippingRebatesTotal>
        <dutiesAndSurchargesTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>0.0</value>
        </dutiesAndSurchargesTotal>
        <itemShippingRebatesTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>0.0</value>
        </itemShippingRebatesTotal>
        <itemTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>2614.07</value>
        </itemTotal>
        <shippingTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>142.78</value>
        </shippingTotal>
        <taxTotal type="Money">
            <currencyMnemonic>USD</currencyMnemonic>
            <value>147.37</value>
        </taxTotal>
    </totals>
    <valueRebates>
        <AppliedRebate name="appliedRebate" type="AppliedRebate">
            <code>INTERSHOP</code>
            <rebateType>OrderValueOffDiscount</rebateType>
        </AppliedRebate>
    </valueRebates>
</Basket>

Reference - WebShop REST APIs

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