hello all
I’m new to Shopify’s new GraphQL APIs.
I’m trying to get an app’s transactions. Tried many variations but so far without success. E.g.:
curl -X POST \
https://partners.shopify.com/<store_id>/api/graphql \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: <mytoken>' \
-d '{ "query": "{ transactions(app:'<myappid>') {}}" }'
what am I doing wrong? just to be sure: that token should from the store or from the app?
The docs don’t give examples for this.
Hey Luis!
mytoken should be {partner-access-token} You can generate this from https://partners.shopify.com/{YourPartnerID}/settings/partner_api_clients/new
Do you get any error while running the query ?
your host might be wrong it should be your store url
I tried that but it’s always a blank response:
curl -X POST \ ~
https://partners.shopify.com/ORG_ID/api/graphql \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: PARTNER_TOKEN' \
-d '{ "query": "{ transactions(app:'APP_ID') {}}" }'
no error. just zero characters back
Hi @Luis_Soares,
I was able to get this to work with the following:
curl -X POST \
https://partners.shopify.com/ORG_ID/api/2025-01/graphql \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: prtapi_XXXXXXXXXX' \
-d '{ "query": "{ transactions(first:10) { edges { node {id }}}}" }'
The main thing was adding the version 2025-01
to and endpoint that will give you the response. It looks like https://partners.shopify.com/ORG_ID/api/graphql
was just returning a 302 redirect to a login page.
Hope this helps,
Daniel
1 Like
It works! Thanks!
but it only returns the ids. how do I get the remaining info? only with additional queries? thanks!
Great! The transactions query can return one of several types, the docs have a full list of the different types.
For each type that you want you’ll need to include a fragment in your GraphQL query that retrieves the specific attributes for that type. For example here’s a query that retrieves some of the AppSubscriptionSale
and AppOneTimeSale
fields:
{
transactions(first: 10) {
edges {
node {
id
createdAt
... on AppSubscriptionSale {
chargeId
grossAmount {
amount
}
shop {
id
}
}
... on AppOneTimeSale {
chargeId
grossAmount {
amount
}
}
}
}
}
}
1 Like
great! how do you pass filters? I only want uninstalls, cancels