Addons are a unique and easy way to enrich the response from a single API endpoint with additional data from other database tables. Addons were created to make it easy to get the data you need without performing multiple API requests. If you’ve used GraphQL before, Addons are very similar except they offer more control over how data is queried.
Imagine if you had a
bookstable and an
authorstable and using Table relationships, while pulling in
authors, you also wanted to pull in their associated
booksin the same request.
How do I create an Addon? There are two different ways to create an Addon:
1. Within, the Function Stack - you can open a Query all Records function. Next, go to the Output tab and select the "+ Addon" button underneath the response body. We recommend this way.
In this example, we are creating an Addon directly from the Function stack of the API endpoint GET all merchant records.
2. Within the Library tab of the navigation bar on the left side, go to Addons and select "Add" in the upper right corner. The Addon page will also have all the saved Addons created from either way. We recommend creating an Addon the first way, then doing any additional customization here.
In this example, we are creating a new Addon from the Addons page of the Library.
When it comes to creating an Addon, both ways are perfectly fine. We recommend starting out with the first way - from within the Query all Records function in the Function Stack. This is because it will give you the clearest picture of how you are using the Addon to extend your data in an API endpoint or Function. You will be taken through a series of steps covered in the following subpages to choose exactly how you want the data returned in your Addon. Once you create your Addon with this framework, it will be saved to the Addons page of the Library. There, you can click on your Addon to see the workflow of an Addon. Once in the workflow view of your Addon, you are able to do further customization of your Addon that you might not be able to do through the Query all Records function flow.