API2Cart v1.1

We have released the API v1.1.  We will support API2Cart v1.0 API until the end of 2018.

What has changed in API v1.1:

  • optimized response structure

  • more info about bundles and configurable products available

  • output format XML is not supported anymore


Optimised Response Structure

  1. We’ve reduced nesting level in response to make it more clear


Old response structure (in API2Cart v1.0)


    "product_options":[

       {

           "option":[

               {

                   "id":"1",

                   "product_option_id":"1",

                   "name":"color",

                   "sort_order":0,

                   "type":"select",

                   "required":"True",

                   "option_value":[

                       {

                           "value":[

                               {

                                   "id":"1",

                                   "product_option_value_id":"1",

                                   "name":"red",

                                   "sort_order":0,

                                   "price":"+10",

                                   "type_price":"value",

                                   "weight":"+0",

                                   "quantity":null,

                                   "sku":null,

                                   "max_characters":null,

                                   "file_extension":null,

                                   "width":null,

                                   "height":null

                               },

                               {

                                   "id":"2",

                                   "product_option_value_id":"2",

                                   "name":"blue",

                                   "sort_order":0,

                                   "price":"-20",

                                   "type_price":"value",

                                   "weight":"+0",

                                   "quantity":null,

                                   "sku":null,

                                   "max_characters":null,

                                   "file_extension":null,

                                   "width":null,

                                   "height":null

                               }

                           ]

                       }

                   ]

               }

           ]

       }

   ]


New response structure (in API2Cart v1.1)


    "product_options":[

       {

           "id":"1",

           "product_option_id":"1",

           "name":"color",

           "description":"color",

           "sort_order":0,

           "type":"select",

           "required":true,

           "option_items":[

               {

                   "id":"1",

                   "product_option_item_id":"1",

                   "name":"red",

                   "sort_order":0,

                   "quantity":null,

                   "price":"+10",

                   "type_price":"value",

                   "weight":"+0",

                   "additional_fields":{

                       "sku":null,

                       "max_characters":null,

                       "file_extension":null,

                       "width":null,

                       "height":null

                   }

               },

               {

                   "id":"2",

                   "product_option_item_id":"2",

                   "name":"blue",

                   "sort_order":0,

                   "quantity":null,

                   "price":"-20",

                   "type_price":"value",

                   "weight":"+0",

                   "additional_fields":{

                       "sku":null,

                       "max_characters":null,

                       "file_extension":null,

                       "width":null,

                       "height":null

                   }

               }

           ]

       }

   ]



    start="2">
  1. Unique fields and those that are not common for all shopping platforms are now returned in the additional_fields field container.  In the response example above you can see that such fields sku, max_characters, file_extension, width, and height are now in the additional_fields container. (This example is taken from Magento response.)



    1. We’ve excluded deprecate fields from the response


    • stores_info

    Now to get info about entities on the particular store you specify the store_id parameter. Let’s say you need to get product info on the store with id=2. This is how your request has to look like:   


    https://api.api2cart.com/v1.1/product.list.json?api_key=xxxx&store_key=xxxx&start=0&count=10&params=force_all&store_id=2  


    Field values in response (e.g. name, description, price, etc.) are displayed exactly as they are on the store.


    • categories

    To get info about the particular category, call the category.info method with specified category_id parameter. To get the list of category ids use either product.id or product.info methods.


    • tax_class

    To get info about the particular tax class, call the tax.class.info method with specified tax_class_id parameter. To get the list of tax class ids use either product.id or product.info methods.


    • variants

    Use product.child_items.list to get info about child elements (bundle items or variants). Learn more in the following paragraph.



    1. Dates are now returned as objects. All dates are returned in ISO-8601 format.



    More info about bundles and configurable products available

    We have added product.child_item.list method for getting info about child items of the product. For configurable products, this method returns the list of variants, for bundles it returns the list of items the bundle consists of. Product.child_item.list returns the number of all bundle items or variants, so that you can set up the pagination, because our API returns up to 250 elements in one request.


    Working with prices:


    • The list_price field returns MSRP (manufacturer's suggested retail price)

    • The wholesale_price field doesn’t exist on all shopping carts. Please keep in mind that advanced_price field contains the info about all other possible product prices, which depend on the customer groups, purchase quantity, etc.


    Please note that you need to specify either product_id or product_ids parameter for this method (separate the IDs with commas). You can identify the parent item of the child item by checking the parent_id parameter.


    What to keep in mind when switching to v1.1

    When switching to v1.1, the first thing to do is to adjust your integration to the new response structure. Thanks to reduced nesting level, new response will be much easier to parse. Also, pay attention to the fields excluded from the new response.

    Finally, make sure your integration work properly with dates. If you use xml format, you better switch to the more convenient and effective json format.


    Partial switch is also possible. You can call both API versions via one integration. Do note that v1.0 will not be supported, though will stay live as-is, starting from January 1, 2019.  All feature requests will be added for v.1.1 solely.