How to get related data using Data API

I have two tables Parent and Child with a Foreign Key from child to Parent.

I wish to access the fields of the Parent when calling the Data API for Child. Is there anyway to implement that ?

The expected payload is something along

{ "response": {
   "unique_id" : "child_id",
   "field_1" : "child_field",
   "parent" : {
            "unique_id" : "parent_id",
            "field_1" : "parent_field"
    }
}

To my knowledge, not without multiple calls. (Perhaps someone else knows otherwise?) It would be great if there was a feature like Stripe’s expanded responses, but Bubble doesn’t have that.

1 Like

With Bubble’s Data API you will only receive this:
"response": {
"unique_id" : "child_id",
"field_1" : "child_field",
"parent" : "parent_id"
}

But with the Workflow API you can determine what is returned so it could be something like this:
"response": {
"child": {All Child data from database}
"parent": {All Parent data from database}
}