Forum Academy Marketplace Showcase Pricing Features

Import data from API

How do i save data into the Bubble database from an API call?

Hi John,

Sam here, with Bubble support. This depends a lot on your specific set up and how you are calling the API in the first place. Here are a few different scenarios and how you would save the data in each scenario:

  • If the API call is a “data” call, you can use “get data from an external API” as part of the dynamic expression in the “make changes to a thing” action to directly call the API and save the data to a field.
  • If the API call is a list of things displayed in a repeating group, you can add a button to each cell which can save the “current cell’s data” to the database.
  • If the API call is an action, you can use make changes to a thing after the API call, and you should be able to reference the “result of step X” to get the API call’s data and save it to a database thing.

I hope this helps. Let me know if you need further clarification on any of these, or if you think that your specific situation calls for something different.

1 Like

Would there be an easier way to save multiple records at once? I already have a mobile application with data and I’m trying to integrate a web app utilizing bubble but I’m having a hard time integrating all the data

If you are trying to bulk import a set of data from another application, the two approaches I would recommend would be:

  1. Export your data from the other application as a CSV file, and then import that CSV into Bubble. This will be the most efficient way to generate multiple records at once for a given data type.
  2. Don’t import your data at all - instead, set up external connections using either the API connector or the SQL connector (if your external app uses an SQL db) to query the other applications database directly from your Bubble app.

I hope this is helpful!

The CVS file doesn’t include data relationships.

Am i able to save the Data from the API into Bubble database?

Hi John -

You wont be able to save data in bulk directly from an API into Bubble - most third party APIs wouldn’t want or allow you to do that - I recognize in your case the API is your own, but the same principles still apply.

To handle relational data, you should import everything as text fields on a designated data type meant for import, and then create backend triggers that create and relate the proper data anytime a new import record is created.

Let me know if you have any specific examples - I’m happy to explain how I would import a CSV and have all of the relational data connect properly.