Get nested object details with Get API(Bubble)

We recently started using Bubble and have been able to make a lot of progress in the last month.
We also have a custom backend in Python and we are integrating it through Bubble APIs. There is a 2-way communication between the Python server and Bubble app using APIs.

My problem is that we are storing a lot of data in the Bubble app, and while reading this data in Python server through Bubble APIs, I cannot get details in Single API.
Specifically, there are 2 data types -

  1. Parent
  2. Child

The Parent has a field in it which is a list of Child objects. Now in the APIs, I want to get all the details of a Parent by ID and all the details of Child objects that are mapped to the Parent. But the Get API for Parent only gives me the IDs of the Child objects. Then I have to Query each Child object using the Child object Get API. These are unnecessary API queries that I want to avoid.

Is there a way to get all the Parent and Child object details in a single API call? I have looked at the forum and the docs, but couldn’t find anything that could solve my query.

Thanks for the help in advance!

Best regards,

1 Like

You can try to create this behaviour using backend workflows that are available as POST Endpoints and the “return data from API” workflow. Using the “format as text” function, you can write your own JSON replies that combine different datatypes into one response.
Keep in mind here that the number of items is limited and you might need to build your own pagination system to not crash your system.

1 Like