Use Case: Coupon Management App
Let's assume that “Coupidon.io”, a coupon management system, developed a widget that enables Duda users to display coupons on a websites. Once a user installs the app, they can drag & drop a widget to the site, enter the coupon ID, and the specified coupon will be displayed. The user needs to retrieve the coupon ID from Coupidon’s platform and copy-paste it to the ID input field in the widget.
Now, Coupidon can change the text input type of the ID to a dropdown and set the dropdown type to “Dynamic”. They’ll set an API endpoint that will dynamically populate the dropdown with all the coupons of the site.
The endpoint will return the “Coupon ID” as a value and the coupon name as a label.
The values in the dropdown can be filtered according to a different field in the widget. For example, Coupidon would like to enable users to filter out all the coupons that expired. They can add a checkbox input field that will enable users to filter out the expired coupons. The checkbox parameter, “expired”, will be appended to the POST request that’s triggered when a user clicks on the dynamic dropdown. If the checkbox is selected, the value of “expired” will be set to TRUE, and the response will return only coupons that are still valid.
Here is an example of what the POST request will look like: