Last updated Dec 13, 2024

Use the GraphQL API toolkit

The GraphQL API toolkit provides methods for making common requests to the Atlassian GraphQL Gateway from a Forge app.

Before you begin

To access GraphQL APIs from your app, install the latest GraphQL API Toolkit package by running:

1
2
npm install @atlassian/forge-graphql

Use the GraphQL API toolkit

Import the @atlassian/forge-graphql package into your Forge app:

1
2
import graphqlGateway from "@atlassian/forge-graphql";

The following example request uses the getComponent method to fetch details about a Compass component. When executing this code, define a componentId variable, which you can find on any component on your Compass site.

1
2
const {
  errors,
  data
} = await graphqlGateway.compass.asApp().getComponent({ componentId });

To view the full documentation for the GraphQL API toolkit, visit the reference documentation.

Rate this page: