Is there a way to retrieve details of list items associated with a “Thing” using Bubble’s GET data API?
Basically, I have defined a component Thing and subcomponent Thing in the DB. Each component has a name, ID, and various other attributes, one of which is a list of sub components.
When I fetch the component details using Bubble’s data API, it simply lists the Bubble ID of the sub components in the JSON response. What I want is for details of the subcomponents to be listed. Is that possible? Am I overlooking a setting or going about things the wrong way?
Ok, so there appears to be no way to “expand” lists when a Thing is retrieved via the data API, which unfortunately, makes the API less useful than I had hoped.
As an example, let’s say I wanted to retrieve order details as a single JSON object, where Order and Item are separate Things in the DB. The Order would be fetched, and it would contain (among other data) a list of ID’s of the items purchased. A separate GET request would then need to be sent to retrieve the detail for those Items using the search API.
If all Order data were needed in a single JSON response, I guess one way would be to implement a “proxy” endpoint which retrieves the main Order and Items "in separate requests and then outputs a single JSON with the aggregate data.
Am I overlooking a simpler approach? Anyone have any ideas?
The bubble API returns a results object.
Running this in your console should establish a promise, then return a response, which will have an array of your data.
My question was about getting related data in a single request. Bubble returns just the unique Bubble ID of related data. One would have to make multiple requests to get all related data. At the time, I think I was looking for something akin to “joining” the results from multiple tables in a single HTTP request.
Anyway, I no longer have this need, but it seems implementing a “proxy” endpoint that issues multiple asynchronous requests “behind the scenes” would be one approach.
Hi, @marcelo1. Nope, no solution unfortunately. It would be really cool, though, if related data could be fetched in a single request up to some arbitrary depth via a query string parameter. It would be super useful and far more efficient to do it server-side than via multiple HTTP requests.
I just learned that Stripe actually has such functionality. It would be super sweet if there was a way to “expand” objects retrieved via the Bubble Data API.
BTW, what’s the official channel for submitting feature requests? Email to support? Submit a bug report?
Have you implemented the expand object in a Stripe Get Call?
I’ve been able to do it for a single properties as well as expanding multiple levels
But can not figure out how to request multiple properties.
I’ve tried setting it up like this below, and although the call is initialized, the raw response doesn’t show both properties…instead it only shows the expansion of a single property and it is always the second in the setup (in example below, it only shows customer object expansion)
As this thread is specifically about the Bubble Data API and not Stripe (I just pointed to Stripe as an example of what I’d like to see in Bubble), if you could move your post or create a new thread, I’d be happy to respond.
That would keep things on topic and enable the proper solution to be marked as such, which would help other forum users (as well as duly credit the one who provided the correct answer).
The need is here and users have identified it years ago, I just do not understand how come it was not prioritised it yet. Furthermore, it does not even seems that complicate to put in place.