I’m trying to get all shipping rates from a Shopify store using GraphQL.
First, I tried with this query, using cursors and pagination:
query($cursor_profile: String = null, $cursor_location: String = null, $cursor_method: String = null) {
deliveryProfiles(first:1, after: $cursor_profile) {
pageInfo {
hasNextPage
}
edges {
cursor
node {
profileLocationGroups {
locationGroupZones(first: 1, after: $cursor_location) {
pageInfo {
hasNextPage
}
edges {
cursor
node {
methodDefinitions(first: 1, after: $cursor_method) {
pageInfo {
hasNextPage
}
edges {
cursor
node {
id
name
}
}
}
}
}
}
}
}
}
}
}
*Please ignore that I’m always asking first:1, it’s just an example.
But, finally I decided to use bulkOperationRunQuery because it would be a mess handling the pagination, so I translated that query to a bulk operation query:
mutation {
bulkOperationRunQuery(
query: """
{
deliveryProfiles {
edges {
node {
id
profileLocationGroups {
locationGroupZones {
edges {
node {
methodDefinitions {
edges {
node {
id
name
}
}
}
}
}
}
}
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
But, I’m getting this response:
{
"data": {
"bulkOperationRunQuery": {
"bulkOperation": null,
"userErrors": [
{
"field": [
"query"
],
"message": "Queries that contain a connection field within a list field are not currently supported."
},
{
"field": [
"query"
],
"message": "The parent 'node' field for a nested connection must select the 'id' field. Connection fields without 'id': locationGroupZones."
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 990,
"restoreRate": 50
}
}
}
}
So, how can get all shipping rates using GraphQL?
Any sugestions?
Thanks.