REST Services & Endpoints

The Data tab on the left-hand side of the Builder is the central location for creating and managing APIs, Services, and Endpoints.

Services

Here is where you can store your own REST API to be used throughout your app. Saving your API connection here allows you to easily re-use it throughout your app as opposed to reconfiguring requests on a screen-by-screen basis with the Fetch component.

When you open the API & Cloud Services modal from the Data tab from the left-side menu, you're presented with the option to add a new API service.

At this time, Draftbit only supports adding Services via REST API and Firebase.

To request a specific integration, visit out Roadmap and create a new request or Upvote an existing request.

Adding a Service

To add a new service, click the Data modal in the left-hand column of the builder. Click REST API under the ADD YOUR CUSTOM API header to add a REST API service.

Configuration

Use the configuration options below to set up your API.

Property

Description

Name

The name of the Service to be displayed in the menu.

Base URL

Cannot end in /.

Note that the additional URL paths and Query parameters for each API endpoint can be configured separately later when you are adding individual endpoints.

Headers & Authentication

Accept: application/json and Content-Type: application/json are the default headers in each REST API configuration.

You can also add any Global Variables you've saved by clicking the '+' in the top right corner, giving the Header a name, and selecting your Global Variable from the dropdown.

Below is an example of adding a Header whose value is stored in a Global Variable.

Editing a Service

To edit an API Service created previously, click the Edit Service as shown below:

Deleting a Service

To delete a Service, click the three dots ("...") next to the name of the Service and then click Delete.

Endpoints

After you've created a new Service, you'll be prompted to add new Endpoints for your service. Configuring endpoints in this menu will allow you to easily reference and re-use endpoints throughout your app.

An API endpoint is the point of entry between an API and a server. The endpoint defines what information you're accessing from your API. For APIs, an endpoint can include a URL of a server or service. Each endpoint is the location from which APIs can access the resources they need to carry out their function.

Adding an endpoint

To add an endpoint, simply click the Add Endpoint button.

Configuration

Property

Description

Endpoint Basics

Set the name of the Endpoint and the HTTP method.

Path & Parameters

Define the path of the endpoint and/or add a query parameter for

Headers

Accept: application/json and Content-Type: application/json are the default headers in each REST API configuration.

You can also add any Global Variables you've saved by clicking the '+' in the top right corner, giving the Header a name, and selecting your Global Variable from the dropdown.

Any Header defined by the API service will be automatically added here.

Test

To verify the response from the endpoint is accurate.

Editing an endpoint

Click on the name of the endpoint in the ENDPOINTS section to be taken to the configuration screen.

Deleting an endpoint

To delete an endpoint, click the three dots ("...") next to the name and click 'Delete'

Additional Resources


Did this page help you?