Swagger

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

Step 1: Create and configure the application

Create a new Radzen application by following the first step from the quickstart guide.

Step 2: Add the Swagger data source

In this step we create a data source that connects to a Swagger services.

  1. Open the application that you created in the previous step for editing.
  2. Click data to go to the My DataSources screen.
  3. Click new to add a new data source.
  4. Select Swagger as data source type.
  5. Pick a Name for your data source.
  6. Enter the Swagger service info.
  7. Click Next.
  8. 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.

Step 3: Automatically generate CRUD pages

  1. Specify primary keys for entities.

  1. Check the Generate pages for CRUD operations check-box.
  2. Radzen will open Edit and Add pages by default in dialogs. Uncheck the check-box if you want to have navigation instead.
  3. 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.

  1. 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.

  2. Invoke Swagger data-source method Flight Affiliate Search on Form component Submit event and provide parameters. Set flights property to invoke result.

  3. Bind DataGrid component to flights property, auto-generate columns and remove unwanted.

  4. Run the application to search flights.

Get Radzen

Sign-up to download the free 30-day Radzen trial.