No API available to get app version for Forge Apps?

I am trying to create a web-trigger(api) to get the version of my forge app but I could not find any

I checked out https://developer.atlassian.com/platform/marketplace/rest/v2/api-group-app-versions/ but it looks like its only for atlassian-connect apps.

atlassian forge apps does not have add-on keys anyway
is there anyway to get app version of my forge app? thanks

1 Like

Hi

I donā€™t believe there is a way for Forge apps to gather such information. Is there a reason youā€™d like access to the app version? We might be able to suggest a workaround.

You can also submit a feature request to this board to expose app version to the Forge app.

@JoshuaHwang hereā€™s some insight as to why:

Connect: if you find a bug, you fix it, deploy and the user simply loads the new deployment without any action required. Most atlassian-connect.json changes also get automatically updated in the customer instance.

Forge: you find a bug, you fix it, deploy it, and Iā€™ve found in most cases the user is required to manually update the app.

As a result you end up with customers on really old versions with bugs. You have no way to force them to upgrade. And so you forever get spammed with invocation error emails and it becomes too complex to debug in the logs.

If I can compare the installed version to the latest version, I can display a message that either encourages or forces the user to upgrade the app.

4 Likes

The version information might be available via the GraphQL API, at least I had retrieved it manually myself at some point - I donā€™t have the particular query handy right now, but as a rule of thumb, many things that are displayed in the developer console (and the version is, as part of an appā€™s installations listing) can be retrieved via requestGraph().

The resp. queries are not officially documented though, so you need to figure them out yourself, e.g. via the built-in GraphIQL explorer. I usually start searching the docs based on guessed keywords, and IIRC the query at hand revolved around App, AppInstallation, and MarketplaceApp .

  • Beware though that some queries still require internal Atlassian authentication, i.e. while we can execute them, we get a 403 ā€œAuthorization failed: Principal has insufficient permissionsā€.

Update

I found a query that yields the desired results when executed manually by the app owner, so the remaining question is whether this query (or a resp. variation) also works when executed from the app itself:

query GetAppInstallationVersion {
  ecosystem {
    appInstallationsByApp(
      filter: {apps: {ids: "ari:cloud:ecosystem::app/<APP_ID>"}}
    ) {
      nodes {
        installationContext
        appEnvironmentVersion {
          version
        }
        version {
          isLatest
        }
      }
    }
  }
}

{
  "data": {
    "ecosystem": {
      "appInstallationsByApp": {
        "nodes": [
          {
            "installationContext": "ari:cloud:jira::site/<SITE_ID>",
            "version": {
              "isLatest": true
            },
            "appEnvironmentVersion": {
              "version": "8.0.0"
            }
          },
          {
            "installationContext": "ari:cloud:jira::site/<SITE_ID>",
            "version": {
              "isLatest": false
            },
            "appEnvironmentVersion": {
              "version": "7.0.0"
            }
          },
[...]
          {
            "installationContext": "ari:cloud:jira::site/<SITE_ID>",
            "version": {
              "isLatest": false
            },
            "appEnvironmentVersion": {
              "version": "6.2.0"
            }
          }
        ]
      }
    }
  }
2 Likes

Hi - these APIs donā€™t support oauth 2.0 as auth mechanism which is required for forge apps to make API calls, so unfortunately you wonā€™t be able to use these queries from inside an app right now

1 Like