Request Parameters:


We can add product to cart as well as wishlist.  This is equivalent as we add to cart product from product detail page.


Below url and parameter use for add to cart product.


URL:  ../Api/Client/DetailAddProductToCart


Header:

Content-Type:application/json


Required Parameters :  


Note:

1) AttributeControlIds:product_attribute_ProductId_ProductAttributeId_ProductAttributeMapId_AttributeValueId  

   (Note: When attribute type is textbox, mutiline or fileupload then instead of attributevalueid pass text that you want to add.)

2) For Shopping cart and wishlist we have to use shoppingCartTypeId 1 and 2 respectively.

3) For nopCommerce 3.40, rentalStartDate and rentalEndDate not supported.

4) If you are Guest Customer then Pass "CustomerGUID":"00000000-0000-0000-0000-000000000000"

5) For updating wish list or cart set UpdateCartItemId. And specify your attribute change as specified at add to cart / wish list time.


Case-1. Incorrect parameters :
Parameter:
{

       "ApiSecretKey":"i99b98d117m116a112o98k115c111",

          "CustomerGUID":"496DBB2A-F9EB-4522-A804-B108693B69CE",

       "StoreId": "1",

        "CurrencyId": "1",

        "ProductId": "900",

        "ShoppingCartTypeId": "1",

        "Quantity": "1",

        "AttributeControlIds": ["product_attribute_16_5_4_13", "product_attribute_16_6_5_15",

        "Product_attribute_16_3_6_18", "product_attribute_16_4_7_20",

        "Product_attribute_16_8_8_22,23,24", "product_attribute_16_4_7_20" ],

        "RentalStartDate": "06/15/2015",

        "RentalEndDate": "06/17/2015"

}
Response :
{

    "Status": 0,

    "Message": "No product found with id : 900",

    "Data": null,

    "ValidationMessage": [],

    "ErrorMessage": null

}


Case-2. Success Response :
Parameter:
{

       "ApiSecretKey":"i99b98d117m116a112o98k115c111",

          "CustomerGUID":"496DBB2A-F9EB-4522-A804-B108693B69CE",

       "StoreId": "1",

        "CurrencyId": "1",

        "ProductId": "16",

        "ShoppingCartTypeId": "1",

        "Quantity": "1",

        "AttributeControlIds": ["product_attribute_16_5_4_13", "product_attribute_16_6_5_15",

        "Product_attribute_16_3_6_18", "product_attribute_16_4_7_20",

        "Product_attribute_16_8_8_22,23,24", "product_attribute_16_4_7_20" ],

        "RentalStartDate": "06/15/2015",

        "RentalEndDate": "06/17/2015"

}

Response :
{

    "Status": 1,

    "Message": "Success.",

    "Data": {

        "CustomerGuid": "496dbb2a-f9eb-4522-a804-b108693b69ce",

        "Message": "The product has been added to your Cart."

    },

    "ValidationMessage": [],

    "ErrorMessage": null

}


Case-3. Success Response (Guest) :
Parameter:
{
  "ApiSecretKey":"i99b98d117m116a112o98k115c111",
  "CustomerGUID":"00000000-0000-0000-0000-000000000000",
  "StoreId": "1",
  "CurrencyId": "1",
  "ProductId": "16",
  "ShoppingCartTypeId": "1",
  "Quantity": "1",
  "AttributeControlIds": ["product_attribute_16_5_4_13", "product_attribute_16_6_5_15",
  "Product_attribute_16_3_6_18", "product_attribute_16_4_7_20",
  "Product_attribute_16_8_8_22,23,24", "product_attribute_16_4_7_20" ],
  "RentalStartDate": "06/15/2015",
  "RentalEndDate": "06/17/2015"
}

Note: RentalStartDate and RentalEndDate format should be MM/dd/yyyy


Response :
{
    "Status": 1,
    "Message": "Success.",
    "Data": {
        "CustomerGuid": "4a915365-7a52-4807-a11e-283f6c627a65",
        "Message": "The product has been added to your Cart."
    },
    "ValidationMessage": [],
    "ErrorMessage": null
}

Case-4. Gift card product :

Parameter:
{
    "ApiSecretKey": "i99b98d117m116a112o98k115c111",
    "CustomerGUID": "496DBB2A-F9EB-4522-A804-B108693B69CE",
    "StoreId": "1",
    "CurrencyId": "1",
    "ProductId": "43",
    "ShoppingCartTypeId": "1",
    "Quantity": "1",
    "AttributeControlIds": [],
    "GiftCardDetails": {
        "RecipientName": "R Name",
        "RecipientEmail": "remail@nop.com",
        "SenderName": "S Name",
        "SenderEmail": "sname@nop.com",
        "Message": "Here is my message"
    }
}

Response :
{
    "Status": 1,
    "Message": "Success.",
    "Data": {
        "CustomerGuid": "496dbb2a-f9eb-4522-a804-b108693b69ce",
        "Message": "The product has been added to your Cart."
    },
    "ValidationMessage": [],
    "ErrorMessage": null
}

Case-5. Product which configured for "customer enters price" :

Parameter:
{
    "ApiSecretKey": "i99b98d117m116a112o98k115c111",
    "CustomerGUID": "496DBB2A-F9EB-4522-A804-B108693B69CE",
    "StoreId": "1",
    "CurrencyId": "1",
    "ProductId": "35",
    "ShoppingCartTypeId": "1",
    "Quantity": "1",
    "AttributeControlIds": [],
    "CustomerEnterPrice":10.20
}

Response :
{
    "Status": 1,
    "Message": "Success.",
    "Data": {
        "CustomerGuid": "496dbb2a-f9eb-4522-a804-b108693b69ce",
        "Message": "The product has been added to your Cart."
    },
    "ValidationMessage": [],
    "ErrorMessage": null
}

Case-6. Update cart or wish list item:

Parameter:
{
    "ApiSecretKey": "i99b98d117m116a112o98k115c111",
    "CustomerGUID": "496DBB2A-F9EB-4522-A804-B108693B69CE",
    "StoreId": "1",
    "CurrencyId": "1",
    "ProductId": "1",
    "Quantity": "1",
    "ShoppingCartTypeId": 2,
    "CustomerEnterPrice": 0,
    "AttributeControlIds": [
        "product_attribute_1_6_1_2",
        "product_attribute_1_7_2_4",
        "product_attribute_1_4_3_6",
        "product_attribute_1_5_4_9",
        "product_attribute_1_9_5_11"
    ],
    "UpdateCartItemId":4104
}

Response:
{
    "Status": 1,
    "Message": "Success.",
    "Data": {
        "CustomerGuid": "496dbb2a-f9eb-4522-a804-b108693b69ce",
        "Message": "The product has been updated to your wishlist. "
    },
    "ValidationMessage": [],
    "ErrorMessage": null
}