GraphQL
Last updated
Was this helpful?
Last updated
Was this helpful?
UI Bakery allows you to easily connect to GraphQL with no need for additional layers like APIs and third-party services.
If your API is hosted behind a Firewall, you need to add our to the Firewall whitelist.
On the Data sources page, click Connect, and select GraphQL in the Data sources list.
Specify the URL to your GraphQL server.
(Optional) Provide HTTP headers and Query Params - they will be sent with every query to the data source but can also be overwritten for each specific query in the action configuration.
Next, select the authentication method in the Authentication settings dropdown:
None
Basic Auth
Digest Auth
OAuth2
API Key
Specify the required credentials according to the authentication method selected.
Click Test connection to check whether the data source can be connected, and then click Connect Datasource to complete the setup.
Create a new action, select your GraphQL data source and the GraphQL Query action will be selected automatically.
Click Execute action.
By default, the GraphQL server returns the 200
status response even if the query failed.
UI Bakery considers a request failed if it contains errors in the response - errors can be accessed via the {{error}}
action variable.
You can also access the raw GraphQL response with the {{res}}
variable.
If your server doesn't support GraphQL , then deselect the Load and save GraphQL schema to allow queries autocomplete checkbox. GraphQL queries will continue to work but autocomplete suggestions in the query editor will be limited.
When you've established the connection between GraphQL and UI Bakery, you can start interacting with its data. For this purpose, you can use the action type:
Next, specify your query. If you need to pass users' data in the query, you can use .