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 from the API & Cloud Services modal.
On the left you can choose from the available options to configure a new API service. On the right your existing services are listed.
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 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 we were setting up a new connection to the above example API, our Prod URL
would be https://api.example.com
. When we create Endpoints for this new service, we could then use the specific path to get a post by its id, for example /posts/{{id}}
.
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.
Property | Description | Example |
---|---|---|
Name | A name for this connection | Xano API |
Dev URL | The base URL that will be used while developing in the Builder and when publishing using the Development Environment | https://xxxx-yyyy-zzzz.a1.xano.io/api:abc123 |
Prod URL | The base URL that will be used when publishing using the Production Environment | https://xxxx-yyyy-zzzz.a1.xano.io/api:abc123 |
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.
Property | Description | Example |
---|---|---|
Key | The HTTP header name | X-APP-ID |
Value | The value associated with the header | x1y2z3 |
Default Values
By default, Draftbit sets the
Accept
andContent-Type
headers toapplication\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 then click Edit Service.
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!
Updated 2 months ago
Once you have an API service set up, you can create Endpoints for that service to use in your app