A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hey,
I'm trying to use the appsubscription grpahql query to get details on a subscription.
This is my query:
query {
node(id: "gid://shopify/AppSubscription/21899804867") {
...on AppSubscription {
createdAt
currentPeriodEnd
}
}
}
But getting a strange error.
I;m able to use Graphql to make other queires, just this one is failing.
Do I need to define the AppSubscription inline fragment somewhere?
Thanks
Arjun
I don't understand why the inline portion of your request is referring back to itself. What if you remove the ...on AppSubscription (with enclosing braces)? Here is a sample of a quick test I made that appears to be formatted okay.
{
appInstallations(first: 5) {
edges {
node {
allSubscriptions(first: 5) {
edges {
node {
createdAt
currentPeriodEnd
id
name
status
test
}
}
}
}
}
}
}
Hi @Gregarican ,
Found the solution -- it was to put a space before on .. as in
... on AppSubscription
GOt the solution from here https://github.com/github/graphql-client/issues/108
The Shopify docs does this without a space : https://shopify.dev/docs/admin-api/graphql/reference/billing/appsubscription - hence the error.
Your solution works when we want to get the last 10 or first 10 etc.. But if we want to get one specific subscription based on ID.. I need to pass the ID no.
Thank you!
Good deal, and I see why you had to use an inline reference to the AppSubscription now. Since you were using the generic node reference as the top point of the query. Glad you got it working!