3 ms·
Shopify's API shows what the minimum ante is for a public-facing GraphQL API: * Exotic rate limiting based on the quantity of data returned, not on the number
by stickfigure 5y ago
Shopify's API shows what the minimum ante is for a public-facing GraphQL API:
* Exotic rate limiting based on the quantity of data returned, not on the number of calls made over time. As a client, it is nearly impossible to throttle your code in any way other than "try and maybe it fails sometimes".
* Tortured graph structure with edges/node/cursor levels in the tree. Navigation is a pain in the ass. See code sample below.
Furthermore, you must provide root query navigation for every object. Shopify doesn't do this. So you end up with nearly impossible places to query to because you need to cursor into a parent to find a particular node, then cursor into its children to get to the right node. There's no limit to the crazy. Building complex shipping profiles with Shopify's API is a nightmare.
Here's a real-world query I pulled out of my code:
query ($id: ID!, $zoneCursor: String) {
deliveryProfile(id: $id) {
id
profileLocationGroups {
locationGroupZones(first: 1, after: $zoneCursor) {
pageInfo {
hasNextPage
}
edges {
cursor
node {
zone {
id
name
countries {
code {
countryCode
}
}
}
methodDefinitions(first: 150) {
pageInfo {
hasNextPage
}
edges {
node {
id
name
active
methodConditions {
operator
field
conditionCriteria {
... on Weight {
unit
value
}
... on MoneyV2 {
amount
currencyCode
}
}
}
rateProvider {
... on DeliveryRateDefinition {
price {
amount
currencyCode
}
}
}
}
}
}
}
}
}
}
}
}
I would much, much rather do this with a series of REST calls. Stripe's API is much more pleasant.