Select theme:
With Radzen Blazor Studio you can connect to a REST API in no time. It scaffolds for you:
In the following tutorial we will show how to:
The tutorial uses the free Spotify REST API. You can either register for free in the Spotify developer portal or use the Radzen test credentials below.
If register your own add https://localhost:5001/api/oauth/spotify/callback to the authorized application Redirect URIs. This is the URL Spotify redirects to after authentication.
You will also need a Spotify account in order to authenticate and use the API.
button.Spotify. The name must be a valid C# identifier. It is used for namespaces and service class names.https://api.spotify.com/v1/. This is the base URL of all Spotify REST API methods.OAuth2. The Spotify REST API uses OAuth2 for authorization.da4bd9113dec43578cca7c59c6bf6e44 or use your own if you have a Spotify developer registration.34269665343a4eec93b9e7620e31c62c or use your own.https://accounts.spotify.com/authorize.https://accounts.spotify.com/api/token.
Radzen Blazor Studio will create a class called SpotifyService which will fetch data from the Spotify REST API.
After configuring the REST API connection details we will add two methods which will fetch data from the Spotify API:
Spotify in the left-hand side of the REST data source connection editor (it should be open from the previous step). This will add a new empty method to the REST data source.GetNewReleases.GET. This is the HTTP method used to request the API.browse/new-releases.You can check the inferred C# models in the Models tab. You can change the automatically generated model names by double clicking them.
You can inspect the actual API response from the Response tab. Any errors would be also displayed there. You
#### Get Album Tracks
1. Click the **+** button next to `Spotify` in the left-hand side of the **REST data source connection** editor (it should be open from the previous step). This will add another empty method to the Spotify REST data source.
1. Set **Name** to `GetAlbumTracks`.
1. Set **Path** to `albums/{id}/tracks`. Note that there there is a `{id}` in the path - this is a **path parameter** and is required by the API method. Radzen Blazor Studio infers it but you need to complete its configuration in the next step.
1. Click the **Path** tab in the **Parameters** section. Set **Name** to `id` and **Type** to `string`. This will configure the `id` path parameter.
1. Click the **Send** button. A dialog would open and ask you to provide a value for the `id` parameter. Use `4aawyAB9vmqN3uQ7FjRGTy` as the Spotify documentation suggests.
1. Click the **Finish** button to generate the code for the Spotify REST data source.
Pages directory and select New Page....Item. This will display the Specify CRUD methods dialog.GetNewReleases(). The generated page will use the GetNewReleases() method of the SpotifyService generated in the previous step.Albums.Items. This means that the data grid component will be bound to the Albums.Items property of the response.

A new page called Items.razor will be generated. You can run the application and after authenticating with Spotify you will see a data grid showing the latest Spotify releases.
Now lets show the tracks for an album from the new releases data grid which we created in the previous step.
GetAlbumTracks method.GetAlbumTracks.Items.
OnOnitializedAsync. We will update the generated code to get the tracks of the first item from the latest releases by default.items.FirstOrDefault().Id. 
Items.razor file and switch to UI design mode. Select the first RadzenDataGrid.GetAlbumTracks method. Set the id argument to args.Id. Use the Expression Editor to do that quickly (use the "link" icon).getAlbumTrack. This will ensure that when the user selects an item from the top data grid the GetAlbumTracks method will be invoked and the result assigned to the getAlbumTrack field
to whic the bottom data grid is bound to. As a result selecting a new item will fetch its tracks from the Spotify API and display them in the bottom data grid.

Here is how to configure the authorization of a REST API protected by AzureAD:
OAuth2.https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize (replace tenant-id with your AzureAD tenant id).https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token (replace tenant-id with your AzureAD tenant id).Radzen is free to use. You can also test the premium features for 15 days.
Start FreeSelect theme: