Other HTTP API updates

Learn about the other recent changes to Composable Commerce APIs, and how they can improve the development of your Projects.

  • After completing this page, you should be able to:

    • Identify how the recent changes affect the use of the Composable Commerce API in your Projects.
  • Check if a resource exists

    Many business flows require you to check whether a resource exists. For example, let's say you want to render a page from your Content Management System (CMS) and part of the data includes a Product. The CMS might give you the basic information required to render the Product, but it cannot tell if the Product is still available in your Project.

    Previously, you would have had to send a request to GET the Products to check if they are still available. This would however mean that you would receive the Product data, which is unnecessary in this case. Developers can now check if a particular resource exists in the project by using a new HEAD method that's available for all our resources. HEAD requests can be faster because the server does not need to send a large body in the response. Developers can use this function either by ID, key, or query predicate for an endpoint. If a resource exists, a 200 OK status is returned; otherwise a 404 Not Found.

    Added support for keys for more resources

    We added support for the key field on more resources, for consistency. A key is a semantic identifier that you can control, while an ID is a technical identifier without much meaning outside the internal-facing Composable Commerce code.

    We added the key field to various Cart and Order data types, including:

    • Parcel
    • Delivery
    • LineItem
    • CustomLineItem
    • LineItemReturnItems
    • CustomLineItemReturnItem
    • ShoppingListLineItem
    • TextLineItem
    • TaxRate

    To make your development easier and the resulting code more robust, many update actions can now be used with a key instead of the ID identifier only. This affects numerous update actions on Carts, Orders, and Order Edits. Line Item and Custom Line Item-relate update actions have the lineItemKey and customLineItemKey fields respectively.

    Enhancements to Carts and Orders

    Carts and Orders are the heart of digital commerce and Composable Commerce. We're constantly striving to assist you in offering a great shopping experience to your customers. In 2023, we added a number of fields to those endpoints, some of which are as follows:

    Test your knowledge