A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi everyone.
I have a question about requests to the Customer Account API.
I want to retrieve subscriptionContract data using 'subscriptionContracts'.
However, I get the response "Field 'subscriptionContracts' doesn't exist on type 'Customer'".
and I cannot retrieve the data.
query MyQuery { customer { subscriptionContracts(first: 10) { nodes { id createdAt nextBillingDate status } } } }
{ "errors": [ { "message": "Field 'subscriptionContracts' doesn't exist on type 'Customer'", "locations": [ { "line": 3, "column": 5 } ], "path": [ "query MyQuery", "customer", "subscriptionContracts" ], "extensions": { "code": "undefinedField", "typeName": "Customer", "fieldName": "subscriptionContracts" } } ] }
Other data, such as displayname, can be retrieved with no problem.
{
customer {
displayName
}
}
I am using Customer Account API version 2024-1.
(and using graphiql)
I cant figure out why this is happening, please tell me where the problem is.
Thank you for your support!
Solved! Go to the solution
This is an accepted solution.
Self resolved.
I was able to get it using CustomerAccountAPI version 2024-04.
Thanks.
It seems that I can get the subscriptionContracts using adminAPI, but I would like to use customeraccountAPI if possible.
It seems that subscriptionContract can be obtained, but I don't know how to get the ID that is the argument.
https://shopify.dev/docs/api/customer/2024-01/objects/SubscriptionContract
Do I need to use adminAPI after all to get the ID?
I would appreciate it if you could tell me.
This is an accepted solution.
Self resolved.
I was able to get it using CustomerAccountAPI version 2024-04.
Thanks.