Importing GraphQL APIs

You can import GraphQL schemas as APIs to IBM® App Connect to create connectors that you can use in your flows.

Before you begin

Before you use App Connect with an imported GraphQL API, check the GraphQL restrictions.

About this task

GraphQL is a query language for APIs and a runtime that runs queries with your own data. You can import GraphQL APIs to App Connect, then connect to them and add them to your flows.

Procedure

To add an imported GraphQL API to App Connect, complete the following steps.

  1. In the App Connect Designer navigation pane, expand Connect, click Applications and APIs, then click the Add connector or API icon (+).
    The Add connector or API icon on the Applications and APIs page to add a connector or API to the catalog.
  2. On the Import or discover page, select Import a connector file or API document, then click Next.
    The image shows that the selected option is "Import a connector file or API document".
  3. On the Import document page, set the Document type to GraphQL.
  4. Provide the OpenAPI file in one of the following ways, then click Next.
    • Drag a .graphql file into the Import box.
    • Click in the Import box then find the .graphql file from a local or network drive.
    At the Import document step, the Document type field is set to GraphQL and the Import field contains the filename test-connector.graphql.
  5. On the Review properties page, enter a name for the API so that you can identify it on the App Connect Applications and APIs page.
    The name can be a maximum of 30 alphanumeric characters and can include spaces, hyphens, underscores, periods, colons, ampersands, asterisks, and parentheses. You can also enter a description of up to 250 characters that summarizes the functions of the API.
    The defined operations in the imported file are shown as actions.
    Note: The Custom GraphQL query object is available by default for all imported GraphQL API connectors. You can use the associated Run custom GraphQL query action to run a custom GraphQL query to request data from a GraphQL server based on your specific needs.
    At the Review properties step, you can see the available actions for the GraphQL API connector.
  6. Click Import connector.

Results

The imported connector is shown in the Not connected section of connectors on the App Connect Applications and APIs page. Expand the connector to see the available actions that you can use in your flows, and to connect to the API.
The imported connector is shown on the Applications and APIs page with a Connect button. The actions for the API are listed, and a link is provided to remove the API.

What to do next

  • To pass data between an imported API and other applications or APIs on the Applications and APIs page, you must connect App Connect to each API and application in the flow. You can connect to the API from the flow editor when you add it to a flow or you can connect from the Applications and APIs page.
  • After you connect to the API, you can add it as a target application to a flow.
  • When you no longer need the API, you can remove it from the Applications and APIs page.
For more information, see How to use IBM App Connect with imported GraphQL APIs.