How to get uninstall reason from Partner API

I’m trying to get the reason for app uninstall. The field in the docs: https://shopify.dev/docs/api/partner/2023-01/objects/RelationshipUninstalled#field-relationshipuninstalled-reason

But the GraphQL query doesn’t work:

{
  app(id: "gid://partners/App/3426665") {
    events(types: [RELATIONSHIP_UNINSTALLED]) {
      edges {
        node {
          reason
        }
      }
    }
  }
}

That returns

{
  "errors": [
    {
      "message": "Field 'reason' doesn't exist on type 'AppEvent'",
      "locations": [
        {
          "line": 37,
          "column": 11
        }
      ],
      "path": [
        "query",
        "app",
        "events",
        "edges",
        "node",
        "reason"
      ],
      "extensions": {
        "code": "undefinedField",
        "typeName": "AppEvent",
        "fieldName": "reason"
      }
    }
  ]
}

How do I get the uninstall reason?

I have a suspicion that Shopify documented this, but got tripped up by GraphQL ignorance and it’s impossible to actually access it.

Hi there! This is Paul from the Weaverse team. :blush:

You can modify the GraphQL query to include reason, description, and shop details by using the following query:

{
  app(id: "gid://partners/App/3426665") {
    events(types: [RELATIONSHIP_UNINSTALLED]) {
      edges {
        node {
          ... on RelationshipUninstalled {
            reason
            description
            shop {
              id
              myshopifyDomain
              name
            }
          }
        }
      }
    }
  }
}

This query will return the uninstall reason, description, and shop details (including the shop ID, myshopifyDomain, and name) for each uninstalls event.

Let me know if this helps or if you need any further assistance. Cheers!

2 Likes

@Weaverse Thanks lot for the your Answers
,I have detail query about the fetching the app events data From the partner API,
I want to get data day wise.
by default graphQL fetching the 100 max record.

problems 1 - I want the all record.
problems 2 - I want the all the data day wise query.