Introducing GraphQL API for Shop
When it comes to online shopping, there are some things customers simply take for granted nowadays. Even if your shop excels in these aspects, it won’t net you a single sale. But if your shop falls behind, it sure can cost you conversions. Performance is one such topic. That’s why our new shop system is optimised for performance, especially when it comes to the most important pages. One step towards this goal is to implement a GraphQL API for product data.
What’s an API?
APIs, or Application Programming Interfaces, serve as the connective tissue between different software components, enabling them to communicate and share data. If you’ve ever wondered how your shop displays your product catalogue in your online shop, this is how. So-called Representational State Transfer APIs (REST) have been an industry standard for years, but GraphQL has gained popularity due to its flexibility and efficiency.
Why GraphQL?
GraphQL is a query language and runtime for APIs that allows clients to request specific data they need, rather than receiving a predetermined set of data like with REST APIs. For online shops, this is particularly relevant for product data.
Imagine, for example, that the majority of online shops wants to display information about different variations of a product on their category pages. But for your customers, that’s just not as important. With a REST API, you would still be forced to transfer all that variation data from your system to your shop. But with GraphQL, you can tell the API exactly what data is necessary for your page and transfer just what you need.
The GraphQL approach minimises unnecessary data transfer, resulting in faster load times, reduced bandwidth usage, and ultimately a better user experience.
How do developers benefit?
If you’re developing with our new shop, GraphQL will provide a major benefit for you: flexibility. With REST, we always had to make a judgement call about which product fields to include and which ones to leave out of the response. In other words, there was always a chance we gave you too much data—slowing down the response time—or too little.
In plentyShop LTS, we tried to bridge this gap using result fields templates. Result fields provided some flexibility for what to include and exclude in the response. The big downside here was that every merchant had to maintain the result fields separately. With GraphQL, you’ll have a programmatic way to request exactly the response data you need, directly inside your application.
Anything to add?
We value your input; share your thoughts on how we can improve this feature.
Stage
🗓️ UP NEXT