eCommerce 101: API for eCommerce and Why It’s Important
Editor's Note: This post was originally published on August, 12, 2021 and has been updated for context and clarity.
Today, virtually anyone is able to launch an eCommerce instance to appeal to the rise of online shoppers. However, if you are a business that is committed to your digital strategy and outpacing the competition, you are very much aware that not just any regular eCommerce instance will be sufficient. To be successful in these competitive markets, businesses will need to ensure:
- Their website is beautifully designed and mobile friendly.
- Their product catalog is clear and relevant.
- Their customer shopping flow is simple and seamless.
- Their shopping experiences are personalized to their unique customers.
But most of all, the #1 criteria to success in the eCommerce industry is speed. And we’re not just referring to the speed of your website load, but also to the:
- Speed to launch your eCommerce instance.
- Speed to customize your eCommerce frontend and backend logic.
- Speed to make changes and optimize your eCommerce solution.
- Speed to adapt to new technologies.
- And the speed to respond to customer demands and expectations.
Your ability to execute with speed will be determined by how well your software and/ or technology communicates. And it’s no secret that traditional legacy platforms have been lacking in this area for a while.
The term “API” has been commonly used throughout the eCommerce ecosystem and has set a precedent for itself. However, many are still unaware of what it really means and how it could enhance their eCommerce strategy. In this post we will dive into an overview of eCommerce APIs and the benefits of adopting them.
Definition of an API eCommerce 101:
At a higher level, it may help to understand what an API is before we narrow down on what an eCommerce API is.
The official description of what an API is:
"An application program interface (API) is a set of routines, protocols, and tools for building software applications. Basically, an API specifies how software components should interact. Additionally, APIs are used when programming graphical user interface (GUI) components."
Put simply, an API declares an interface for you to interact with its logic without you having to know what is happening under the hood, masking the complexity and making it easy to consume and use.
While there are many technology options for building an API, the programming world has adopted REST as the industry standard. RESTful (representational state transfer) APIs have provided a straight-forward way to work with data with an intuitive naming structure and HTTP verbs for specific CRUD (create, read, update, delete) actions.
What is an eCommerce API?
Now we’ve defined an API at a high level so let’s get down to what it is. An eCommerce API is a collection of eCommerce functionality exposed via API. To break down the specific eCommerce functionality this includes at the very minimum, cart, checkout, payments and orders - or in other words a way to transact on your eCommerce sites, acting as the connecting tissue between the frontend (head) and backend (body). Medium.com created a simple infographic to explain below:
Why use an API for eCommerce?
As previously defined, APIs allow you to interact with the logic without needing to know what is happening under the hood. This is great for eCommerce websites because there is a ton of logic that you need to access but at the same time you don’t want to have to handle the complexity that supports all of this logic.
An API is the ideal delivery mechanism for eCommerce because eCommerce logic and functionality can be inherently complex.
This creates a natural split between your frontend and backend operations and the underlying commerce engine. This turns ordinary developers into super-charged developers thanks to increased efficiencies and productivity. No longer do you need an expensive full-stack or proprietary eCommerce platform developer. This allows you to deploy new commerce solutions and get to market faster while having access to a wider developer talent pool.
Top Considerations for Evaluating an eCommerce API
A practical approach to API design
Below you’ll find some key areas to consider and explore when you come to evaluating an e-commerce API that will fit your business and/or project requirements.
Location & Response Times
Whether this be for legal, security, or compliance reasons the location of the API and its databases is something else you will likely need to consider.
Elastic Path continuously works toward improving site latency. Many times requests have unique considerations that make them difficult or even impossible to cache. Working with partners like Fastly, we can leverage their services to validate requests and cache them appropriately, therefore improving cache coverage and hit ratio.
You’ll ideally want to ensure the location of your API is within or close to the location of your customers and the response rates are below 200-300ms for the most part, although there are some exceptions for more complex queries.
API-first or Retrofitted API Enabled
There is another key difference to be aware of when evaluating APIs and that is to go back to understand how the API first came to be.
Many traditional eCommerce platforms did not start out with an eCommerce API design and instead built APIs as a bolt on to their core platform, which we refer to as retrofitted API-enabled, primarily to enable an ecosystem of third-party integrations.
This key difference affects the feature/functionality coverage area of the API in terms of what is available and also how the API fundamentally works as it has to interact with this more closed, restrictive platform core.
These bolted-on APIs are tightly coupled with the front-end design. This creates strict requirements on user-flow and website structure.
On the other hand, API-first means exactly that, the entire product has been designed from the ground up to be consumed via APIs (as Elastic Path has been). This leads to 100% (or close to) coverage in feature functionality.
We usually find that those that adopt an API-first eCommerce service implement their projects far faster than with a solution that uses bolt-on APIs, as there are less workarounds and hacks required to achieve your desired results.
A differentiator of Elastic Path Commerce Cloud is the use of microservices for each business functionality. Each endpoint has a dedicated team and database, loosely coupled with other services. These services deploy independently, therefore eliminating the tightly woven structure: updates are quicker, and you eliminate the need to replace functionality in one motion but instead over time. The business value of your new platform is in a position to be identified much earlier in the replatforming process.
Extensibility & Event-Driven Architecture
Most eCommerce APIs tend to enable custom data in two different ways. The first is as simple key value pairs which is great if you’re just storing some simple data but can fall short for more complex scenarios as the onus on validation rests entirely with the development.
The second way that traditional eCommerce platforms handle customization is on a case-by- case, specific feature/functionality basis. How you extend the product catalog is completely different from how you extend the customer record or an order. This greatly increases the learning curve of the platform and slows down development time as you find yourself hopping from one dashboard page, directory, file, or line of code to the next.
Beyond extensibility of the schema comes interoperability, or in other words the way in which the API integrates with other providers and vendors. With structured custom data as part of the puzzle, you also have to look towards how the events and communication work between other best-in-class services.
A traditional system would require a developer to modify the database, application, API, front-end, and administration screens to add new fields. This is extremely time consuming and expensive. This is why traditional systems try to guess at every possible field you may need. Unfortunately, every business is different so that leaves them using fields with the wrong name or going through an expensive process.
By contrast, Elastic Path Commerce Cloud allows any user to add fields quickly through the commerce manager or by making a single API call. These fields are immediately available in the API and admin screens for use.
Setting up a custom data model can be handled in minutes instead of weeks. Due to this simplicity of extending the data model, modern systems come with very few default fields and instead allow companies to decide the data most relevant to their business.
Further Benefits of Event-Driven Architecture
- Easier to program against events and follows modern best practices.
- Instead of relying on nightly jobs or batches, events allow for real-time integrations, data movement, and business logic.
- If a batch job fails, a lot of data is lost and it's difficult to retry. By contrast if an event logic fails, it is straightforward to retry and is built into AWS queue functionality. Only a single entry is affected why the retries take place.
Developer Experience & Documentation Quality
The quality of the developer experience is another important factor to consider when evaluating APIs for eCommerce. A poor experience can negatively impact your time to market, significantly increase maintenance and ultimately development cost.
A few key considerations you should explore & questions you should ask when it comes to the developer experience include: Is the API consistent, standardized and human read-able to requests and response objects across all endpoints, or is each API endpoint different and require its own learning curve? Can a developer read the documentation in a couple of minutes for one endpoint, and re-use that knowledge across all API endpoints?
Has the eCommerce logic and complexity been well abstracted, or are there multiple endpoints and features spread across multiple requests? Does it take several API requests to process an action that could be handled in a single request? Having to make several round-trip calls can slow down implementation and your web application performance.
How easy is it to navigate and browse the documentation to find answers to your questions? Is there a change log and status page?
Knowing when something has changed or when services encounter issues is critical to the smooth operation of your eCommerce business.
Is there a community forum or ticket-based support system for questions, best practice advice or for when things go wrong? Is there a high-quality Postman that covers the entire breadth of the commerce API that you can download to rapidly test drive the API?
All of the questions outlined above around the developer experience will directly impact implementation time, and ultimately the development cost. In other words, a positive developer experience will lead to faster implementation times and lower costs, whereas a negative or sub-par developer experience will lead to longer implementation cycles and higher costs.
Additionally worth noting with an API-first, Composable Commerce approach, a developer can leverage any coding language, technology, or techniques they prefer. This means developers end up using the tools they already know and understand for a more positive experience.
As highlighted before, this means hiring developers who can hit the ground running and get projects to market faster becomes easier - not the case for businesses using technology that requires more specialized developer skill sets.
As you can see, when it comes to understanding what an eCommerce API is and how to evaluate what makes a great API there are many things to consider. This article is in no way an exhaustive list and is simply some of the top areas you should consider when evaluating them.