Get data Partner Dashboard

I am trying to get data from my partner dashboard such as: Install count, revenue, etc.

I am not able to figure out the correct query to do that same:

Here’s what I have figured out till now:

POST URL: https://partners.shopify.com/[organization_id]/api/2023-07/graphql.json

Header i did correct.

I just need help in “Data” part to send within my request

Hi Ameyacharya,

To fetch app install count, revenue, and other related data, you need to use specific queries in your request data. Below is an example of how you might construct your query:

query {
  partner {
    organization(id: "[organization_id]") {
      apps {
        edges {
          node {
            title
            installationsCount
            appCharges {
              edges {
                node {
                  price {
                    amount
                    currencyCode
                  }
                  status
                }
              }
            }
          }
        }
      }
    }
  }
}

In the above example, you’d replace [organization_id] with your actual organization ID.

This query fetches the title of each app, the count of installations, the charges for each app including the price amount and currency, and the status of the charge.

Please note that the API might not support all the fields directly, so if a field is not supported, you would need to remove it from the query.

In your POST request, this query would be included in the body something like this:

{
  "query": "your_query_here"
}

Again, replace your_query_here with the actual query. Try to apply this to your use-case as the exact fields and structure might differ based on the API version you’re using and the specific data you have access to.

Hope this helps!

Can you please check again?

When I am trying to run the same code it says “Partner” is not in Queryroot.

Hi @ameyacharya :waving_hand:

To query installations and charges on an app, app.events can be filtered by the event types:

{
    app (id:"gid://partners/App/123") {
        installs: events(first: 10, types:RELATIONSHIP_INSTALLED) {
            edges {
                node {
                    type
                    occurredAt
                    shop {id}
                }
            }
        }
        charges: events(first: 10, types:[ONE_TIME_CHARGE_ACCEPTED, SUBSCRIPTION_CHARGE_ACCEPTED, USAGE_CHARGE_APPLIED]) {
            edges {
                node {
                    type
                    occurredAt
                    shop {id}
                }
            }
        }
    }
}

Hope that helps!

With this query, I can get the install count and uninstalled count. The difference between them will give me the Active users.

My doubt is, instead of getting the first 20 or 100 installs I want all of them. If not possible maybe I can get all installs for a particular time period.

Hey @ameyacharya - you should be able to pull all of your install events using pagination. Here’s an example query:

{
app (id:“gid://partners/App/app-id-here”) {
installs: events(first: 10, types:RELATIONSHIP_INSTALLED) {
edges {
cursor
node {
type
occurredAt
shop {id}
}
}
pageInfo {
hasNextPage
}
}
charges: events(first: 10, types:[ONE_TIME_CHARGE_ACCEPTED, SUBSCRIPTION_CHARGE_ACCEPTED, USAGE_CHARGE_APPLIED]) {
edges {
cursor
node {
type
occurredAt
shop {id}
}
}
pageInfo {
hasNextPage
}
}
}
}

In the response, you’ll receive a cursor for each edge, and a hasNextPage boolean (true/false) in pageInfo, letting you know if there are more entries that fit your query criteria. You can then put the cursor output you received into a sequential query like this:

{
app (id:“gid://partners/App/app-id”) {
installs: events(first: 10, after: “cursor-value-here”, types:RELATIONSHIP_INSTALLED) {
edges {
cursor
node {
type
occurredAt
shop {id}
}
}
pageInfo {
hasNextPage
}
}
charges: events(first: 10, after: “cursor-value-here”, types:[ONE_TIME_CHARGE_ACCEPTED, SUBSCRIPTION_CHARGE_ACCEPTED, USAGE_CHARGE_APPLIED]) {
edges {
cursor
node {
type
occurredAt
shop {id}
}
}
pageInfo {
hasNextPage
}
}
}
}

There’s a good reference document here on paginating within our GraphQL APIs that might help if you had any further questions. Hope this helps!

Al | Shopify Developer Support

[removed duplicate post - error occurred]