Welcome to the first edition of our API features roundup. API releases at Shopify often include a lot of different changes, and we realize that it can be a challenge to understand how all of these changes can be adopted to improve the quality of your apps. Starting with this release, a roundup post like this will accompany each release to highlight the most significant changes to the platform.
This October is our biggest release yet. Many of the features that were announced at Shopify Unite have shipped into the stable 2019-10 release.
Working with Shopify data is at the core of this version, with new APIs to expand the utility of metafields, bulk operations to reduce the number of calls that you need to make, and new methods for paginating with REST that dramatically reduce the amount of time that it takes to page through results. Other additive changes include support for 3D secure payments, and dedicated support for multilanguage using the Translations API.
Let’s dig into what these changes mean for you, and how you can adopt them to improve the quality and performance of your apps.
In this article
1. Requesting data from Shopify
When you need a large amount of data about a product catalog, performance, or customer marketing preferences, getting that data from Shopify quickly and easily is incredibly important.
Traditionally, apps would make synchronous REST requests to Shopify to get this data. That request chain would look something like this:
This pattern would work if the shop in question had a small product catalog, but when we get into larger datasets, a problem starts emerging:
Due to an increasing SQL offset (that you can read about in detail on our Engineering Blog), the response time starts to grow. Since the call limit in REST is two requests every second, a common approach to making more requests was to thread them to create concurrency.
While making concurrent requests does help saturate the call limit, it also scales very poorly. With increasing page offsets, requests slow down more, which then requires more concurrency to saturate the call limit.
We have two new tools to help solve this problem at scale.
Pagination with relative cursors
Relative cursor pagination remembers where you were, so that each request after the first continues from where the previous request left off. This increase in performance means that it’s easy to saturate the call limit without needing to build in concurrency. At very high offsets, using a relative cursor is more than 400x faster against the database than using page
!
Learn more about pagination in our docs.
Bulk operations
With a single request, you can use bulk operations to kick off a job that will fetch all of the data that you need, and then return a single JSONL file with the results of your request. Instead of fully saturating your call limit while you wait for thousands of requests to finish, you can make a single request that doesn't count against your call limit, and finishes in a fraction of the time.
Here’s a breakdown of how each approach affects fetching a product catalog with 50,000 items :
|
Page (old) |
Relative cursors |
Bulk operations |
Time to fetch data |
115 seconds |
85 seconds |
25 seconds |
Number of requests |
200 |
200 |
2 |
Learn more about how the Bulk Operations API works in our docs.
2. Storing data in Shopify
Metafields have always been an effective way to append relevant data to Shopify resources, but were also accessible by any API client that had access to the resource. With the release of the 2019-10 version, metafields can now be privately scoped to your API client. This means that when you want to add metadata to a resource, you can do so without other apps having access to this data. Private metafields are a convenient, secure way to store additional data that can shift some of the responsibility of storing data back onto Shopify.
Learn more about metafields in our docs.
3. Translations
A historically common use of metafields has been to store information about translations for international buyers. While mostly functional, there are a lot of places that metafields just don’t cut it. Payment gateways, email templates, shop policies, SMS templates, and links have never been translatable with metafields, but the new Translations API in GraphQL makes all of this possible. Themes now have the ability to natively support translations without needing to leverage metafields, and apps can offer translations for a huge number of customer facing resources.
The following resource types and fields are now translatable:
- Collection:
title
,body_html
- Email template:
title
,body_html
- Link:
title
- Buyer facing metafields:
value
- Online store article:
title
,body_html
,summary_html
- Online store blog:
title
- Online store page:
title
,body_html
- Online store theme: dynamic keys based on theme data
- Payment gateway:
name
- Product:
title
,body_html
- Product option:
name
- Product variant:
title
,option 1
,option 2
,option 3
- Shop:
meta_title
,meta_description
- Shop policy:
body
- SMS template:
body
4. 3D Secure Payments
Lastly, the Revised Payment Service Directive, also known as PSD2, will be implemented in all countries in the European Economic Area (EEA) this fall. Shopify has implemented the 3D Secure payment authentication method to help you stay compliant if you’re an affected European gateway. You can read more about the changes that we’ve made to help your gateways stay compliant in our docs.
Stay on top of changes
To stay up to date with the changes coming to the next release, remember to subscribe to the Developer Changelog so that you can start using features as soon as they ship into the release candidate for 2020-01.
Read more
- Increase Merchant Trust: Introducing Updates to the Shopify Order API
- API Deprecation at Shopify: 2022-04 Edition
- Shopify Storefront API: Updates to Power Custom Storefronts
- Shopify API Release: January 2020
- API Deprecation at Shopify: 2021-07 Edition
- Shopify API Release: April 2021
- Shopify API Release: January 2022
- Shopify API Release: July 2020
- API Deprecation at Shopify: 2022-01 Edition
Questions about any of these updates? Share your thoughts in the comments below.