Selecting the output from an API

Options
I have a table of Users who create Orders
I have table of Suppliers who fulfill Orders
Orders table has two relationships - Users and Orders

I have an API that filters all the orders by User (GET orders_of_user) and displays the Supplier record id rather than the Supplier Name.  How to get the Output to return the content of the supplierName column. 

In SQL I would do something like this,  
Select  Orders.ordernum, Orders.orderdate, Orders.total, User.name, Supplier.name 
WHERE Order.userid = User.id
AND Order.supplier_id  = Suppliers.id
 
How to I revise my GET orders_of_user (just like Prakash's Stuff_of_user from the youtube videos) to pull the supplierName from suppliers table based on the suppliers_id in the api response. 

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Hey  you would use an Addon to decorate your API response with the supplier's name. You would just map orders.supplier_id to supplier.id when creating the Addon.