Edit

Share via


Fabric API for GraphQL introspection and schema export

The Fabric API for GraphQL provides two mechanisms to retrieve information about your schema.

  1. Introspection: It's part of the GraphQL standard and enables programmatic querying of the schema. Introspection queries allow you to learn about a GraphQL API’s schema, and they also help power GraphQL development tools.

  2. Schema export: It allows you to obtain an SDL (GraphQL Schema Definition Language) file that contains your complete schema for external use.

Introspection

By default, introspection is disabled on your API for GraphQL items. This setting can only be toggled by Workspace Admins. All other users will see a disabled slider. To enable it, click on the API Settings gear icon in the top menu and choose Introspection from the available settings. You'll see a toggle to enable or disable introspection:

Screenshot that shows the portal bar showing the settings gear button.

Screenshot that shows the introspection setting slider.

If you enable introspection, the following confirmation dialog is displayed:

Screenshot that shows the enable introspection confirmation dialog.

Select confirm to enable introspection or cancel to leave it disabled.

Introspection query example

Here's a quick example of an introspection query to retrieve available types from the schema:

query {
    __schema {
        types{
            name
        }
    }
}

Screenshot that shows the introspection query example.

The information retrieved by introspection queries is verbose. You can use query filters to narrow the scope of the query.

To learn more about introspection, see the GraphQL Foundation's official documentation on introspection.

Export schema

Another way to retrieve schema information is using the GraphQL schema export. It works directly from the Fabric portal. Open your API for GraphQL and select Export schema. And your browser will download an SDL (Schema Definition Language) file with full schema. You can then use this SDL file in any development tool or service such as, for example, integrating with Azure API Management.

Screenshot that shows the export schema button.