Import GraphQL API Definitions

You can upload your existing GraphQL API definitions to API Hub for Design by implementing the standard API importing features. The imported queries are then displayable and searchable in your organization's API catalog.

Using Registry API or the API Hub for Design interface, you can not only add new GraphQL definitions, but also overwrite or export the existing ones.

Import a GraphQL definition

All GraphQL queries must be imported as .graphql or .gql files. Note that the .json format is not supported for this specification. Both owners and designers can import GraphQL APIs to their organization.

To import a GraphQL definition using the API Hub for Design interface, perform the following steps:

  1. On the API Hub for Design landing page, select the Import API tile.

    Alternatively, click Create New in the left sidebar and select Import and Document API.

  2. In the new dialog, click Browse and paste the link or choose the file containing the GraphQL collection you want to import.

    AHDesign_screenshot_import_graphQL_01.png
  3. After API Hub for Design has validated the selected collection as a correct.graphql or .gql file, specify the name and version of the definition you want to create.

    .

    AHDesign_screenshot_import_graphQL_02.png
    • Name – The API name is its unique ID and is part of its path on API Hub for Design, as in https://app.swaggerhub.com/api/{OwnerID}/petstore/1.0. Requirements:

      • 3 to 60 character long

      • Allowed characters: A..Z a..z 0..9 - _ .

      • Must start and end with a letter or digit

      Note that API names are case-sensitive, so petstore and PetStore are two different APIs.

      Tip

      To import the definition as a new version of an existing API, enter the name of the existing API.

    • Version – The version of the imported API. It is specified in the info.version field of the definition.

  4. Select Import definition to complete the process.

Browse GraphQL definitions

The imported GraphQL files are listed in your organization's My APIs page. In the main catalog, you can view the following attributes of these definitions:

  • Name

  • Resource type

  • Specification type

To easily navigate to your GraphQL APIs, enter their attributes in the search field.

Similar to other API specifications, you can also add GraphQL definitions to your organization's projects.

Display or export a GraphQL definition

After importing a GraphQL definition or navigating to it from your organization's catalog, the API is displayed in detail. Note that API Hub for Design does not support this API format's edition.

You can download your GraphQL definition as a file matching the format of the original import. To initiate the download, select the Export option available on the toolbar.

AHDesign_screenshot_import_graphQL_03.png
Publication date: