Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

how to make a query to get AppUsageRecord list

Solved

how to make a query to get AppUsageRecord list

xBei-Qiu
Shopify Partner
11 1 1

use appUsageRecordCreate  can create a AppUsageRecord.

but how to get the  record list?

 

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 525

This is an accepted solution.

Hey @xBei-Qiu

 

You can retrieve that through the appInstallation and active subscription. 

 

https://shopify.dev/docs/api/admin-graphql/2023-10/objects/AppInstallation#field-appinstallation-act... 


The specific connection here: https://shopify.dev/docs/api/admin-graphql/2023-10/objects/AppSubscriptionLineItem#connection-usager... 

 

Hope that helps, 

 

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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

View solution in original post

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1453 238 525

This is an accepted solution.

Hey @xBei-Qiu

 

You can retrieve that through the appInstallation and active subscription. 

 

https://shopify.dev/docs/api/admin-graphql/2023-10/objects/AppInstallation#field-appinstallation-act... 


The specific connection here: https://shopify.dev/docs/api/admin-graphql/2023-10/objects/AppSubscriptionLineItem#connection-usager... 

 

Hope that helps, 

 

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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

xBei-Qiu
Shopify Partner
11 1 1

it work.

thanks.

query {
  appInstallation(id: "gid://shopify/AppInstallation/123456") {
    app {
      id
    }
      subscriptions{
        id
        lineItems{
          id,
          plan{
            pricingDetails{
             __typename
             }
          }
          usageRecords(first:100){
            edges{
              node{
                id,
                description
                createdAt
                price{
                  amount,
                  currencyCode
                }
              }
            }
            pageInfo{
              hasNextPage
              endCursor
              startCursor
            }
          }
        }
      }
    
  }
}