Creating bulk data with a backend workflow API

Hi everyone!

I am currently working on a real estate app. Everything’s going great so far, Bubble is indeed an amazing tool!

But here’s the thing that worries me the most: a pretty big amount of our client’s data comes from their own APIs or broadcaster services. There can be up to 20 services with up to 800 properties per service, and of course, all of this needs to go into Bubble’s DB… and be updated daily. By updated I mean that the data that’s been previously stored should be deleted, and the new one saved.

What would be the best way of implementing this kind of feature?

I tried using a backend workflow API but couldn’t figure out how to POST an object containing other objects (The Property table contains a Rooms’ one, with some other properties, such as Media, that contains the Picture’s one, and so on…).

Here’s a part of the POST request I’m sending:

{
"FlatInfos": {
    "Floor": {"HasElevator": "false", "Position": 2, "Total": 6}
    },
"Media": {
    "Pictures": [
            {"Url": "https://url1.com/photos/5-06.jpg"},
            {"Url": "https://url2.com/photos/5-06.jpg"},
            {"Url": "https://url3.com/photos/5-06.jpg"},
    ]
    },
"MinimumRentalDuration": "shortTerm",
"NbOfRooms": 5

}

And here are some screenshots of the DB structure mentioned above:





I tried both options Detect request data and Manual definition.
When using the first one, I can’t create a Room since the detected type is not that of a Room, not sure why, though.

When using the second one, I keep getting the following response when hitting the POST button:

{
"statusCode": 400,
"body": {
    "status": "MISSING_DATA",
    "message": "Invalid data for field Pictures: object with this id does not exist: [object Object]"
}

}

Not sure why I’m being asked for an Id when trying to POST data?

Sorry if it’s a bit confusing, I tried to explain it the best I could!

1 Like

Fields on bubble aren’t objects but instead reference fields. You can’t save an object to a field. You CAN save a unique id from a corresponding table in a reference field.

Hi @jared.gibb and thanks!

Ok, that would explain why it kept asking for an Id when trying to post.

So if I understand correctly, I would have to create the nested tables and then add their reference id in the parent table?

This topic was automatically closed after 70 days. New replies are no longer allowed.