REST API Services

REST APIs allow you to connect your app to a server or backend using standard HTTPS

You can manage all your API services in the API & Cloud Services modal accessible from the option in the left menu bar of the Builder.

Apart from adding a custom REST API service, Draftbit supports various services such as Xano, Supabase, Backendless, Airtable and more as well. Just about any REST-like API that sends and receives JSON is compatible with Draftbit.

Once you have added an API service, you can then create Endpoints for that connection to use with API Request Actions and Fetch components throughout your app

Adding a Service

Click on one of the available options on the left to begin configuring a new service.

Importing from Another App

You can also copy an existing configured Service from another app using the Copy from another app button in the left panel.

This will import the Service and all of it's associated REST API Endpoints

Configuring a Service

Use the configuration options to set up your new API service.

API Basics

Here you can set the Name and Base URLs for your new API service. In this example, https://api.example.com is the base URL for the API and /posts/123 is the endpoint path.

If you were setting up a new connection to the above example API, our Base URL would be https://api.example.com.

When you create Endpoints for this new service, you can use the specific path to get a post by its id using {{variable}} formatting, for example /posts/{{id}}. You'll be able to pass values to any variables that you create on the Service's Endpoints when using an API Request Action or Fetch component in your app.

⚠️

HTTPS is required

All API service Base URLs need to support SSL connections over HTTPS.

⚠️

Localhost not supported

API services need to be accessible over the internet. To connect Draftbit with your localhost, you'll need a secure tunnel that supports HTTPS. Expose is a handy service for this.

PropertyDescriptionExample
NameA name for this connectionXano API
Dev URLThe base URL that will be used while developing in the Builder and when publishing using the Development Environmenthttps://xxxx-yyyy-zzzz.a1.xano.io/api:abc123
Prod URLThe base URL that will be used when publishing using the Production Environmenthttps://xxxx-yyyy-zzzz.a1.xano.io/api:abc123
Configuration ModeYou can either create your endpoints manually, or import from an OpenAPI schema. See OpenAPI Spec section below for more.Manual or OpenAPI

OpenAPI Schema

This section is enabled when you have chosen OpenAPI for the service's Configuration Mode.

The OpenAPI Specification allows an API to provide a description of itself encoded in a JSON document. If your API provides an OpenAPI schema, Draftbit can use that to automatically create the Endpoints for the API service, and keep them updated, so you don't have to manage them manually.

PropertyDescription
Schema URLA URL which can be accessed with a GET request, which returns your OpenAPI schema.
Refresh IntervalYou may configure your schema to be automatically refreshed at regular intervals. You can always re-fetch your schema manually using the Fetch Schema button.
HeadersInclude any headers needed to fetch your schema. For example, if your schema endpoint requires authentication you might need an Authorization header.

⚠️

When you choose OpenAPI as the Configuration Mode for your service, the Endpoints which are automatically created will only allow certain properties to be changed - such as Test/Default values.

If you need to make changes to these Endpoints, it's recommended to either update your OpenAPI schema and then run Fetch Schema to get the latest changes synced to Draftbit OR switch the Endpoint's Configuration Mode to Manual.

Headers

If you need to set custom HTTP headers for ALL Endpoints that will be associated with this Service, you can set them here. If you only need to set HTTP headers for specific Endpoints, you can set those up when creating the Endpoints.

You can type a value directly into the value field or select a variable that you've created from the dropdown.

PropertyDescriptionExample
KeyThe HTTP header nameX-APP-ID
ValueThe value associated with the headerx1y2z3

📘

JSON Data Type

By default, Draftbit sets the Accept and Content-Type headers to application\json since Draftbit only supports JSON data.

Editing a Service

To edit an API Service created previously, click on the service from your list of services.

Duplicating a Service

To duplicate a Service, click the overflow menu (...) for the service you want to duplicate and then click Duplicate.

Deleting a Service

To delete a Service, click the overflow menu (...) for the service you want to delete and then click Delete.

❗️

This is permanent

When you delete an API Service all associated Endpoints will also be deleted and any Fetch components and API Request Actions that reference the Endpoints will also be reset. This can't be undone!


What’s Next

Once you have an API service set up, you can create Endpoints for that service to use in your app