Map an id to an object and return just a single item.
Using the same framework from within the Query all Records function, this example will return a single item. Once again this example, will use an Addon to extend the response of the merchant table with the deal table.
In step 1 of creating a new Addon we will add the deal table to the response:
In this example, we are choosing the deal table to add to the response.
Next, we will choose to return the data by a single item.
In this example, we are choosing to return the data by a single item.
Next, select how what fields to map the deal table to the merchant database table.
In this example, we are mapping the merchant_id in the deal table to the merchant database table.
Lastly, we hit done, give the Addon a name, and have the option to customize the response. Once finished, the response on the output tab will update to show us the newly extended response:
In this example, we see the response is updated with the Addon.
When we Run & Debug this endpoint, we will see the response is extended with the deal of merchant Addon. In this example, it will only return one single item.
In this example, when we run the API endpoint with the Addon, the Addon is returning a single deal with the associated merchant record.