1

I am writing a frontend that lists some custom data. It calls an endpoint /rest/v1/custom/get that hooks into my CustomListInterface defined in the webapi.xml, this then returns a list of records in a custom database.

+-------------+----------+-------------+
|  entity_id  |   title  |    order_id |
+-------------+----------+-------------+
|       1     |   Test   |       2     |
+-------------+----------+-------------+

So when I call the endpoint, it outputs the json to represent the data structure of the table.

{
    entity_id: 1, 
    title : "Test",
    order_id : 2
}

What I want is for the result to JOIN the order table and return a more complex structure such as.

    {
    entity_id: 1, 
    title : "Test",
    order_id : 2,
    order : {
         entity_id : 2,
         base_total: 125.0000,
         qty : 4,
         increment_id : "M8036863"
    }
}

Can anyone point me in the right direction or suggest some examples in the codebase of how best to implement this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.