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:

That URL is structured like this:

No custom domain

VersionURL

Development (Main branch)

https://myapp.bubbleapps.io/version-test/api/1.1/obj

Development

(custom branch)

https://myapp.bubbleapps.io/[branch-id]/api/1.1/obj

Live

https://myapp.bubbleapps.io/api/1.1/obj

Custom domain

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

VersionURL

Development (Main branch)

https://mydomain.com/version-test/api/1.1/obj

Development

(custom branch)

https://mydomain.com/[branch-id]/api/1.1/obj

Live

https://mydomain.com/api/1.1/obj

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:

Data Type name

Correct Data API formatting

Rental Unit

rentalunit

Sports Team

sportsteam

Cake Recipe

cakerecipe

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

VersionURL

Development (Main branch)

https://myapp.bubbleapps.io/version-test/api/1.1/obj/rentalunit

Development (custom branch)

https://myapp.bubbleapps.io/branch-id/api/1.1/obj/rentalunit

Live

https://myapp.bubbleapps.io/api/1.1/obj/rentalunit

Custom domain

VersionURL

Development (Main branch)

https://myapp.bubbleapps.io/version-test/api/1.1/obj/rentalunit

Development (custom branch)

https://myapp.bubbleapps.io/branch-id/api/1.1/obj/rentalunit

Live

https://myapp.bubbleapps.io/api/1.1/obj/rentalunit

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.

Action

Description

GET

Retrieve data

POST

Create data

PUT

Update data

PATCH

Replace data

DELETE

Delete data

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