For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
Hi everyone!
I try to use Subscriptiopn API to get information about orders which created by subscription.
I use tags for this aleready but I need to use new Subscription API. Is it possible or not?
I found a method subscriptionContracts which may contains connection field SubscriptionContract.orders. I call subscriptionContracts and get Access denied error but my app has full access rights. Where did I mistake? Or maybe it's a wrong way to get information about that orders from SubscriptionContract?
Request to: admin/api/2021-10/graphql.json
Request body:
{
subscriptionContracts(first: 10) {
edges {
node {
id
createdAt
orders {
edges {
node {
id
}
}
}
}
}
}
}
Response:
{
"data": null,
"errors": [
{
"message": "Access denied for subscriptionContracts field.",
"locations": [
{
"line": 3,
"column": 3
}
],
"path": [
"subscriptionContracts"
],
"extensions": {
"code": "ACCESS_DENIED",
"documentation": "https://shopify.dev/api/usage/access-scopes"
}
}
],
"extensions": {
"cost": {
"requestedQueryCost": 32,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 998,
"restoreRate": 50.0
}
}
}
}
Again , app has full access rights and I can get orders successfully for example.
Thanks!
Hey @AleksandrWREP 🙂
Your GraphQL query looks correct except for a `orders(first:10)`, I've tested this locally.
{
subscriptionContracts(first: 10) {
edges {
node {
id
createdAt
orders (first: 10) {
edges {
node {
id
}
}
}
}
}
}
}
The issue you are seeing comes from a permissions issue.
Requires Requires read_own_subscription_contracts or write_own_subscription_contracts scope.
Please see: https://shopify.dev/api/admin-graphql/2021-10/objects/subscriptioncontract#top and https://shopify.dev/api/usage/access-scopes
To learn more visit the Shopify Help Center or the Community Blog.