Bubble export - What to add in the body ? Very confusing

Hi,

I have created a flow in which I import data from bubble, run a few flows and then export it to bubble. Currently I have no idea on how to proceed with sending the data as Parabola asks me to fill the body field and unfortunately I have no idea of what to add there. I’ve read the tutorial and a few posts here, but it’s greek to me, as I have very little knowledge of JSON. Can someone help me ? Many thanks

Hey @Mateus_Coelho,

Taking a look at their documentation, it looks like they have a few ways to export data to Bubble. Since your Bubble database can consist of just about anything, their documentation tends to be broad.

To create a thing, send a POST request to the /typename endpoint for the type of thing you want to create. The body of the request should be a JSON object to use as the new thing. Your endpoint might look like this:

https://appname.bubbleapps.io/api/1.1/obj/typename

Be sure to swap out appname with the name of your actual app. You’ll also want to structure your JSON like this:

{
    "key1": value,
    "key2": value,
    "key3": value
}

Swap out the keys for the column headers from your Bubble import. Add as many keys that are necessary to make sure the data you’re wanting to export is represented in a key. The last key should not have a trailing comma.

If your Bubble import contained information about cars your data could look like this:

{
    "Make": {Make},
    "Model": {Model},
    "Year": {Year},
    "Color": {Color}
}

Text wrapped in curly brackets should also reference the name of your column headers. That will dynamically insert the value of each row when making your request.

Hope that helps!

Thanks Daniel, that is helpful, though I do not want to create a thing using POST, but to modify things, therefore using PATCH. For some weird reason, bubble is giving me an error 405, which means they dont recognize the method which doesnt seem to make sense. What do you think ?

Thanks

Hey Mateus,

This is likely due to the endpoint. When making a PATCH request, you’ll likely need to pass the ID of the thing that you’re trying to update.

If you’re importing from Bubble, some sort of column with an Id related to the thing is returned. If your data has a list of products, your endpoint could look like this:

https://appname.bubbleapps.io/api/1.1/obj/products/{id_column}

You can then pass in your JSON body by referencing the column names instead of the literal values. Parabola will then insert the values from your columns when making a request.

Hey @daniel many thanks. I’ve added a video below to better illustrate my case. Can you take a look at it and let me know your thoughts ? Thanks again!

Vidyard Recording?

Hey @Mateus_Coelho,

Thanks for sharing that video! Mind answering these questions for me?

Can you let me know where you found the endpoint to the PUT request?

Their documentation references this endpoint:
https://appname.bubbleapps.io/api/1.1/obj/typename/unique_id

Does your Bubble import contain some sort of Id column?

The 405 error is likely attributed to the fact that you are not passing the Id of the item you’re trying to overwrite into the URL. From what I can tell, the PUT method is not allowed unless that Id is referenced in the URL.

Does your Bubble import contain column headers like Notes, Availability, Description, Price, etc?

If so, is there a cell under your Notes column that contains the value Saving notes on product page?

Instead of writing Notes multiple times in your JSON body and adding all of those values, you just need to add it once and reference the column as {Notes}. In Parabola it might look like:

{
  "Notes": {Notes},
  "Availability": {Availability},
  "Description": {Description},
  "Price": {Price},
  "Product_Name": {Product_Name}
...
}

What it actually sends to Bubble:

[{
  "Notes": "Saving notes on product page",
  "Availability": true,
  "Description": "Broccoli, spinach, avocado, apple, lemon (16oz, 242kcal). 242 calories.",
  "Price": 7,
  "Product_Name": "Joe's Green Mile"
...
}
{
  "Notes": "Saving more notes",
  "Availability": true,
  "Description": "Strawberry, raspberry, banana, coconut, lemon (16oz, 242kcal). 242 calories.",
  "Price": 8,
  "Product_Name": "Berry smoothie"
...
}]

Send an email to help@parabola.io and we can schedule some time to troubleshoot live.

1 Like

Hey Daniel, thanks for the support. Please see below my answers:

[quote=“daniel, post:6, topic:1502, full:true”]
Hey @Mateus_Coelho,

Thanks for sharing that video! Mind answering these questions for me?

Can you let me know where you found the endpoint to the PUT request? - In the bubble app in Settings.

Their documentation references this endpoint:
https://appname.bubbleapps.io/api/1.1/obj/typename/unique_id

Does your Bubble import contain some sort of Id column? - Yes, it does indeed.

The 405 error is likely attributed to the fact that you are not passing the Id of the item you’re trying to overwrite into the URL. From what I can tell, the PUT method is not allowed unless that Id is referenced in the URL.

Does your Bubble import contain column headers like Notes, Availability, Description, Price, etc? - Yes

If so, is there a cell under your Notes column that contains the value Saving notes on product page?

Instead of writing Notes multiple times in your JSON body and adding all of those values, you just need to add it once and reference the column as {Notes}. In Parabola it might look like: - Love it. Will try to replicate it now and see if I can get it to work following your instructions.

{
  "Notes": {Notes},
  "Availability": {Availability},
  "Description": {Description},
  "Price": {Price},
  "Product_Name": {Product_Name}
...
}

What it actually sends to Bubble:

[{
  "Notes": "Saving notes on product page",
  "Availability": true,
  "Description": "Broccoli, spinach, avocado, apple, lemon (16oz, 242kcal). 242 calories.",
  "Price": 7,
  "Product_Name": "Joe's Green Mile"
...
}
{
  "Notes": "Saving more notes",
  "Availability": true,
  "Description": "Strawberry, raspberry, banana, coconut, lemon (16oz, 242kcal). 242 calories.",
  "Price": 8,
  "Product_Name": "Berry smoothie"
...
}]

Send an email to help@parabola.io and we can schedule some time to troubleshoot live.
[/quote] - Sounds great, let me see if I can get this to work and if not I’ll send and email to schedule a session. Many thanks

1 Like

This is a PATCH that works for me. I am using PATCH instead of PUT as I don’t want to replace everything.

Some things to watch out for …

  1. You need to add in some sort of “id” field on the end of the endpoint
  2. Naming of Bubble fields - check what the input in the Bubble Import has got- and copy that. It can change from your data tab to Parabola
  3. Back to 1 … if you don’t have it exactly right it will crap out in weird ways

1 Like

Thanks @NigelG this is helpful, little by little we’re getting there. I’m still wondering a few things though:

  1. Is PATCH the right method for my case ? In my scenario I am scraping data everyday using a third party and receiving it straight into Parabola. Then, Parabola processes the data and sends the results back to my bubble database. This needs to run everyday automatically. The data may or may not change on a daily basis, but I am sending an update everyday to bubble regardless, as I can never be sure of exactly which fields will have changed. Since I can never know what will change I need to update everything, therefore I’m thinking PUT would be right in this case ?

  2. Regarding the id in the Endpoint. How do I figure that out ? For instance, let’s say I am scraping data for certain Products (that’s also the data type in bubble) and inside the Data Type Product I have certain fields like Price (number) and Availability(boolean). How do I figure out the id for Price ? Apologies if this a dumb question…

What do you think? Thank you

  1. it is the Bubble internal id. So if you use _id it should work. But do check in the Import

  1. To PUT you need to provide EVERYTHING that comes back in the GET. So Modified date etc. But up to you.
1 Like

Brilliant, let me try. Thanks again

1 Like

Oh, I forgot one more gotcha :slight_smile:

This probably doesn’t apply to your situation, but just in case…

You will need to pre-populate 1 row in Bubble so that Parabola finds the fields, Bubble doesn’t return null data on the GET.

If you are loading a Bubble table from scratch using 3 add/update/delete matches …you will need to have at least one “dummy” row in the Bubble table to start with. Give it a random “id” (whatever you are using to do the updates) otherwise the run will completely REALLY quicky, do nothing, and you will be charged credits :slight_smile:

Oh, and check the “Use field display …” as it will stop Bubble adding _text etc to the end of your field name. Just makes it easier to type these later on.

image

Just don’t tick it once it is all set up!

Also, despite the fact that Parabola CLEARLY knows the Bubble column names … it will not give you any hint when typing them into to JSON. Check and double check :slight_smile:

Also, make sure that you have a Goggle geocode key set up in your app, as it will fail with too many geocalls (2000 rows usually) at some point if you don’t don’t.

1 Like

Hey everyone, hope all is well. I’ve made great progress with these flows based @daniel and @NigelG 's help here. So thanks again guys.

Everything is working except now one field I’ve added, which is causing me to get an error 400, as you can see below :

{
“body”: {
“message”: “Invalid data for field All issues v1: Out of Stock cannot be parsed as a JSON”,
“status”: “INVALID_DATA”
},
“statusCode”: 400
}

Any idea on why this data would not be allowed to be parsed as JSON ? I suspect it’s something small like a comma in the wrong place or something, but could be completely wrong.

Many thanks!