Data API endpoints

This section covers how to identify the correct endpoint when using the Bubble Data API.

Help us improve this article

This article is part of a significant update to the Bubble manual and your feedback is critical to our efforts to continuously enhance our written documentation. We would greatly appreciate if you could take a moment to let us know your thoughts on the quality of it. Thank you for your support! Give feedback on this article

Introduction

Remember our lesson from earlier when we explored that whenever a client sends an API request, they are attempting to reach a specific resource. The URL, short for Universal Resource Locator, shows the way to this resource.

Bubble automatically generates a URL – known as an endpoint – for each data type you activate in the Data API. By using this URL in an API request, a client will reach the correct data type – the resource.

Root URL

The URL consists of a root URL that’s unique for every version of every app you create but remains the same for all data types. As soon as you have activated the Data API, Bubble will reveal your app's root URL in the API settings:

When you activate the Data API, Bubble reveals the root url of your application.

That URL is structured like this:

No custom domain

Custom domain

If you have connected your app to a custom domain, the URL will look like this:

As you can see, the root URL points the client towards your app’s API and obj (object) means we want to interact with objects (data records) in the database.

What’s missing?

The Data Type URL

The final piece of the puzzle is to let the server know which data type we want to access. For that we need to include the name of the data type. Data type names in the Data API are the same as what you named them in the Bubble database editor, except it needs to be formatted in the following way:

  • Remove spaces

  • Use lowercase letters

For example, the following data type names would need to be formatted as the following:

Make sure to always use unique Data Type names.

If two or more Data Types share the same name, the Data API will return the first one it finds, which may lead to unexpected behavior.

If we want to access the Rental Unit data type, the full endpoint URL would look like this:

No custom domain

Custom domain

The HTTP Action

To complete an endpoint, we need to know both the URL to the resource we want to access, and the (GET, PUT, POST, DELETE) that determines what we want to do with that data type.

The table above shows the most common HTTP methods used in an API call. To learn more about what an HTTP method is from a more technical perspective, check out our guide on How RESTful APIs work and HTTP methods specifically.

Next we will look at how to set up some common requests.

Last updated