Radzen can connect to Swagger services and can create automatically CRUD pages if entity key is provided.
How to build the application
- Step 1: Create and configure the application
- Step 2: Add the Swagger data source
- Step 3: Automatically generate CRUD pages
Create a new Radzen application by following the first step from the quickstart guide.
In this step we create a data source that connects to a Swagger services.
- Open the application that you created in the previous step for editing.
- Click data to go to the My DataSources screen.
- Click new to add a new data source.
- Select Swagger as data source type.
- Pick a Name for your data source.
- Enter the Swagger service info.
- Click Next.
- Radzen will connect to the service and infer all paths/operations. By default all paths/operations are checked and you can choose/uncheck paths/operations needed for your application.
For this article we are using Amadeus Travel Records Swagger API. To get API Key please register/login and create an app here.
- Specify primary keys for entities.
- Check the Generate pages for CRUD operations check-box.
- Radzen will open Edit and Add pages by default in dialogs. Uncheck the check-box if you want to have navigation instead.
- Click Finish.
Invoke Swagger operation with parameters and display the result in DataGrid component.
In this section we will show you how to search flights using Amadeus API.
Create a page with Form component. Add form fields for origin, destination, departure, return and adults properties needed for Flight Affiliate Search data-source operation invoke. Change departure and return properties field type to date and adults to integer. Check required for all form fields.
Invoke Swagger data-source method Flight Affiliate Search on Form component Submit event and provide parameters. Set flights property to invoke result.
Bind DataGrid component to flights property, auto-generate columns and remove unwanted.
Run the application to search flights.