Backend Web API Service / REST API
- 3 minutes to read
Overview
The Solution Wizard creates a backend Web API Service (Web API) with integrated authorization and CRUD operations powered by Microsoft EF Core and DevExpress XPO ORM library. You can use OAuth2, JWT or custom strategies for authentication. The built-in Security System also filters out secured server data based on permissions granted to users.
The Web API creates URLs (endpoints) that allow you to perform CRUD operations from your non-XAF UI applications (for instance, .NET MAUI, JavaScript or Blazor clients). It uses ASP.NET Core OData 8.0 (OData v4.0) to support paging, filters, and other OData options. This service can be hosted as part of a Blazor Server project or as a standalone ASP.NET Core project.
The Web API utilizes Swagger (OpenAPI) to display and test endpoints. You can also test endpoints or consume the Web API with other platforms (for example, Postman, .NET, or JavaScript).
The basic functions of our Web API Service (including the Solution Wizard) are available for FREE as part of our .NET App Security & Web API Service free offer. To register your free copy today, please visit: https://www.devexpress.com/security-api-free.
Additional services/benefits of our Web API Service ship as part of the DevExpress Universal Subscription and include:
- Technical support and full source code
- XAF’s administrative UI to manage users and roles at runtime using WinForms, WebForms, and Blazor apps
- Localization functions (endpoints to obtain localized captions for classes, members, and custom UI elements)
- Advanced/enterprise functions such as audit trail, endpoints to download reports, file attachments, check validation, etc.
See Also
Note
The Solution Wizard template for Web API .NET projects is available in Visual Studio 2022+ after you run the Universal Component Installer from the Download Manager.
How to Use
You can add the Web API to an existing Blazor Server project or create a new project with this service:
- Create a new application with the Web API.
- Add a Web API project to an existing application.
- Add the Web API service to a Blazor Server project.
After you add the Web API to your project, you can use it as described in the following articles:
- Add CRUD Endpoints and Consume the Web API.
- Make HTTP Requests to the Web API from .NET Applications.
- Execute Custom Operations on Endpoint Requests.
- Create Custom Endpoints.
- Access Object Space, Security System, and Caption Helper in Custom Endpoint Methods.
Authentication Options
The Web API supports all standard ASP.NET Core authentication techniques that you can specify in the MySolution.WebApi\Startup.cs (MySolution.Blazor.Server.Startup.cs) file. See the following topic for details: Authentication in Web API Projects.
Performance Considerations
You can disable logging to improve the Web API performance. To do this, set the LogLevel.DevExpress.ExpressApp option to None.
File: MySolution.Blazor.Server\appsettings.json (MySolution.Blazor.Server\appsettings.Development.json for debugging)
// ...
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"DevExpress.ExpressApp": "None"
}
// ...
Use logging options other than None (for example, the DevExpress.ExpressApp = Debug
) only for debugging purposes because logging reduces performance. See the following topic for more information: Log Files.
Use the Web API as the Middle Tier Server in WinForms Applications
You can also use the Web API as the Middle Tier Server in WinForms Applications. See the following topics for details: