Discussing APIs and development related to customers, discounts, and order management.
I'm trying to query marketingEvents for my store using both the REST and GraphQL endpoints and they're both returning an empty list. I'm using the shopify_python_api.
# make a rest call to get marketing events
events = shopify.MarketingEvent.find(limit=250)
pprint.pprint(events)
# graphql query to get marketing events
query = """
{
marketingActivities(first:10){
edges{
node{
createdAt
status
app {
id
}
marketingEvent {
id
}
}
}
}
}
"""
graphql_response = shopify.GraphQL().execute(query)
pprint.pprint(graphql_response)
Both approaches return an empty result set
[]
'{"data":{"marketingActivities":{"edges":[]}},"extensions":{"cost":{"requestedQueryCost":32,"actualQueryCost":2,"throttleStatus":{"maximumAvailable":1000.0,"currentlyAvailable":998,"restoreRate":50.0}}}}'
I've confirmed my api key has the correct scopes:
Hi CamLux,
Can you make this query without using the shopify_python_api? EG: by using the graphiql app? If the call can be made via the graphiql app, then this issue is related to the python API.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks for your response. When using the graphiql_app it works and I see data
But when making a request via postman the very same query gives me an internal server error. Shouldn't I be able to access this data?
"message": "Internal error. Looks like something went wrong on our end.\nRequest ID: f3186755-dc01-4f77-87b1-32fd452b77b5 (include this in support requests).",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"requestId": "f3186755-dc01-4f77-87b1-32fd452b77b5"
}
Hi again CamLux,
So if the query is working with the GraphiQL app but not with your own, there could be some configuration, or authentication issue preventing it. Does your app have the same permissions set up as the scopes you added to the GraphiQL app?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog