APIs & Services

In the APIs & Services tab under the Project Settings, you're able to save queries on an app-level. Saving your queries here allows you to easily re-use queries throughout your app as opposed to reconfiguring request URLs/authorization on a screen-by-screen basis.

REST

Here you'll see configuration options similar to those under the standalone Fetch component.

Config

Parameter

Description

Name

The name for of your service

Base URL

The base URL of your API (you can configure endpoints later inside of the Fetch component)

HTTP Mode

Credentials

Fetch Policy

Lazy Request

You can include any Variables saved under Global Variables as a Header inside of this modal.

Once you've configured and saved your API, you can then add it directly to any Fetch component on any screen across your app.

Airtable Configuration

Open the Airtable Base you'd like to connect to your app and go to the API documentation (you can find this by clicking the 'Help' button at the top right of your Base and selecting API documentation from the dropdown).

Go to the Authentication section of the API documentation and select the 'show API key' checkbox (outlined in red in the screenshot below) to generate your key.

Only copy the portion that says Bearer key************** (blocked out in red in the screenshot above). In Draftbit, click the Settings button in the left-hand column and go to the Variables tab. Enter a name for your variable in the Name input, paste the API key (Bearer key**************) into the Key input, and then click 'Add'.

Now, go back to Airtable API documentation and copy the Base URL from the Authentication section. (Make sure you leave out the Table name! You can add the Table name when configuring the API directly in the Build Query modal. The highlighted portion of the screenshot below is what you should be copying here). Once you have your Base URL you can return to the Builder.

Go to the Services tab and add a new REST API. Enter a name for the service in the input and paste the Base URL you just copied into the Base URL input.

Next, go to the 'Headers' tab and click the 'Add' button to add a new Key/Value pair. Make sure you enter 'Authorization' as the Key and add the Variable you just saved as a Value from the Custom Value dropdown. Your setup should match the screenshot below.

Once finished, you can click the Save button and your Airtable API will be ready for you to use throughout your app.


Did this page help you?