Using GraphQL API: Get all installed plugins in jira cloud instance

Hello [Community/Support Team],

I hope this message finds you well. I am currently working with a Jira extension and have encountered a deprecated warning related to the use of ExtensionContext.installations in my GraphQL queries. The warning suggests utilizing appInstallationsByApp or appInstallationsByContext queries instead.

Below is a snippet of the GraphQL query and the associated warning:

Res:

{
    "data": {
        "extensionContexts": [
            {
                "extensionsByType": [],
                "installations": {
                    "nodes": [],
                    "pageInfo": {
                        "endCursor": null,
                        "hasNextPage": false
                    }
                }
            }
        ]
    },
    "extensions": {
        "gateway": {
            "request_id": "f5c1815eacaf4304991a87ea041bfa5f",
            "crossRegion": false,
            "edgeCrossRegion": false,
            "deprecatedFieldsUsed": [
                "ExtensionContext.installations : Use `appInstallationsByApp` or `appInstallationsByContext` queries instead (extensionContexts/installations)"
            ]
        }
    }
}

I have been trying to find documentation or instructions on how to implement the recommended alternatives (appInstallationsByApp or appInstallationsByContext), but unfortunately, I couldn’t locate any relevant information.

Could you kindly confirm if these alternative methods are still functional, and if so, provide guidance or documentation on how to use them? Alternatively, if there are other approaches or best practices I should consider for fetching information about installed apps, I would greatly appreciate your advice.

Thank you in advance for your assistance!

Ref:

1 Like

After a few days of research, I finally figured out how to use appInstallationsByContext.
I’ll leave the example below for those who need it.

Query get list forge app:


query jira_manageApps_getEcosystemInstalledApps {
    ecosystem {
        appInstallationsByContext(
            filter: {
                appInstallations: {
                    contexts: ["ari:cloud:jira::site/your-site-cloud-id-here"]
                }
            }
            after: null
        ) {
            nodes {
                id
                createdAt
                license {
                    active
                    type
                    supportEntitlementNumber
                    ccpEntitlementId
                    ccpEntitlementSlug
                    trialEndDate
                    isEvaluation
                    subscriptionEndDate
                    billingPeriod
                }
                app {
                    contactLink
                    createdBy {
                        name
                    }
                    description
                    id
                    tags
                    marketplaceApp {
                        appKey
                        name
                        tagline
                        logo {
                            scaled {
                                id
                            }
                        }
                        versions(filter: { productHostingOptions: CLOUD, visibility: PUBLIC }) {
                            edges {
                                node {
                                    paymentModel
                                    deployment {
                                        ... on MarketplaceCloudAppDeployment {
                                            cloudAppVersionId
                                            scopes {
                                                id
                                                capability
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    name
                    privacyPolicy
                    termsOfService
                    vendorName
                }
                appEnvironment {
                    key
                    type
                    oauthClient {
                        clientID
                    }
                }
                appEnvironmentVersion {
                    id
                    version
                    requiresLicense
                    isLatest
                    permissions {
                        scopes {
                            key
                        }
                    }
                }
            }
            pageInfo {
                endCursor
                hasNextPage
            }
        }
    }
    extensionContexts(
        contextIds: ["ari:cloud:jira::site/0b8afe9e-4cdd-47b4-81c1-fc6a966a583e"]
    ) {
        adminPageExtensions: extensionsByType(type: "jira:adminPage") {
            id
            environmentId
            environmentType
            properties
            type
            appVersion
            installationId
        }
        configurePageExtensions: extensionsByType(type: "connect-jira:configurePage") {
            id
            environmentId
            environmentType
            properties
            type
            appVersion
            installationId
            migrationKey
            key
        }
        postInstallPageExtensions: extensionsByType(
            type: "connect-jira:postInstallPage"
        ) {
            id
            environmentId
            environmentType
            properties
            type
            appVersion
            installationId
            migrationKey
            key
        }
        extensionsByType(type: "jira:adminPage") {
            id
            environmentId
            environmentType
            properties
            type
            appVersion
            installationId
        }
    }
}
                                    

Query return the cloud ID of a Jira site:

query example {
  tenantContexts(hostNames:["your-domain.atlassian.net"]) {
    cloudId
  }
}
5 Likes

@DuyenNguyen , how did you call this query ? I was able to get data by using Graphql Explorer. But calling it from the forge code by api.asUser().requestGraph gave me an error Auth category: THIRD_PARTY_OAUTH is not allowed in service cs_apps. Any suggestions what can be wrong ?