In the fast-moving world of retail technology, there’s always a new way of doing things that makes tasks better, more reliable, and faster. Enter GraphQL, an API specification that is shaking up the world of retail e-commerce.
What is GraphQL?
GraphQL is a bit of an enigma. Even though it’s popular as a query language, there is more to it than just that. In addition to being a query language, GraphQL is also a system for the execution semantics for queries and their validation by the APIs. APIs are a set of routines, protocols, and tools for building software applications that specify how software components should interact. In other words, GraphQL is both the code and the means by which the code executes its actions.
Where did GraphQL come from?
GraphQL was developed internally by Facebook in 2012 before being publicly released in 2015. In 2018, the GraphQL project was moved from Facebook to the GraphQL Foundation, which is hosted by the non-profit Linux Foundation.
What is unique about GraphQL?
GraphQL isn’t tied to any specific database or storage engine or even a programming language. It can even be layered on to existing code and data. This is key to its power and agility. Being “protocol-agnostic”, too, GraphQL can connect to various systems and fetch data faster and more efficiently than other specifications like REST.
GraphQL also lets you decide what data you need and returns only that. This reduces network latency, making your storefronts faster and reduces network usage costs.
All communication with GraphQL happens using a single URL, as opposed to the typical many, which makes it much easier to use.
What are the advantages of GraphQL for Retailers?
A single view of distributed systems, partial data fetches and developer experience.
A single view of distributed systems
GraphQL hides the complexity of multiple systems working together and provides a single API layer for interactions. This can be built upon existing code quickly and can re-use the existing, already optimized functions to fetch the data faster.
Partial data fetches
With specifications like REST, when you send a request, the response payload is a pre-defined, fixed format. This means every client who makes the call receives the same sized response. As a client, some of this data may be relevant to you, some may not. But because the response format is fixed you might over-fetch data. The result? Additional latency and network usage costs for all requests. But with GraphQL, clients can just retrieve fields relevant to them, so the payload is reduced. Less data is faster and cheaper.
Apart from the joys of interacting with a single API instead of multiple systems built on a variety of platforms, GraphQL offers more to developers. As GraphQL is hosted on a single URL and comes with attached documentation, it is more developer-friendly.
But at Fluent we’ve taken the advantages of GraphQL one step further.
Why is Fluent’s approach to GraphQL different?
One word: Workflows. Workflows are the foundation of Fluent Order Management. Essentially, they’re business processes. They contain your business rules and determine how each order is fulfilled. But unlike traditional APIs, where the logic is stored in the API itself, in Fluent Order Management, the business logic used to control the API is also stored in the workflow. This means the API is only used to persist the data and query it when needed.
By removing logic from the API itself and locating it in the workflow, we’ve made it easier to adapt and customize Fluent Order Management with little to no dependency on the API team.
What does this mean for retailers?
Faster storefronts and in-store applications.
When a customer does a checkout, an API call checks the availability of items in the customer’s cart. Typically, a response payload from such a call would contain the following information:
- All the requested items
- Whether the cart can be fulfilled
- Whether a split in order will be required
- Locations to fulfill the requested items, etc.
All that information can make the response very large. So, for example, if your checkout screen doesn’t need to show whether the order will be split, you can skip that information and reduce the payload size for a faster response. And faster page loads mean a better customer experience.
What are the benefits of GraphQL for a Distributed Order Management platform?
GraphQL has huge benefits for Fluent Order Management .
Being data-source agnostic, GraphQL can be the single API that unifies multiple legacy systems and hides all their complexity behind it. Whether it’s data from in-store Point of Sale (POS) systems, ERP systems, or other data sources like a legacy warehouse management system (WMS), GraphQL can combine data from different sources and provide a single API with a combined view of the artifacts.
In short, products that leverage retail GraphQL can make your eCommerce experience faster, more efficient and cheaper. By not over-fetching data, you’ll save on data warehousing costs. By speeding the time to serve data, you’ll have happier customers. While GraphQL isn’t a silver-bullet meant to solve every eCommerce challenge, it’s a powerful technology that should be a key part of your tech stack if you want to compete in the world of e-commerce.