| name | abp-api |
| description | ABP Framework v10.x (10.4/10.5) API development: Auto API Controllers, dynamic and static C#/JS client proxies, Swagger, API versioning, Integration Services. Use when you need a REST API, controller, dynamic proxy or client generation in ABP. |
ABP Framework — API Development
ABP Framework v10.x (10.4/10.5) API development. Auto API Controllers, Dynamic/Static C# Clients, Swagger, API Versioning.
Trigger
- "ABP API controller"
- "ABP auto controller"
- "ABP dynamic client"
- "ABP swagger"
- "ABP API versioning"
- "ABP REST API"
Auto API Controllers
PreConfigure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly);
});
HTTP Method Mapping
| Prefix | HTTP |
|---|
GetList, GetAll, Get | GET |
Put, Update | PUT |
Delete, Remove | DELETE |
Create, Add, Insert, Post | POST |
Patch | PATCH |
Route Examples
| Method | Route |
|---|
GetAsync(Guid id) | /api/app/book/{id} |
GetListAsync() | /api/app/book |
CreateAsync(CreateBookDto input) | /api/app/book |
UpdateAsync(Guid id, UpdateBookDto input) | /api/app/book/{id} |
DeleteAsync(Guid id) | /api/app/book/{id} |
RemoteService
[RemoteService(IsEnabled = false)]
public class PersonAppService : ApplicationService { }
Dynamic C# Client Proxies
abp add-package Volo.Abp.Http.Client
context.Services.AddHttpClientProxies(typeof(BookStoreApplicationContractsModule).Assembly);
{ "RemoteServices": { "Default": { "BaseUrl": "http://localhost:53929/" } } }
var books = await _bookAppService.GetListAsync();
Static C# Client Proxies
abp generate-proxy -t csharp
abp generate-proxy -t csharp --without-contracts
Swagger
context.Services.AddAbpSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
});
app.UseSwagger();
app.UseAbpSwaggerUI(options => options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1"));
API Versioning
[ApiVersion("1.0")]
[ApiVersion("2.0")]
public class BookAppService : ApplicationService, IBookAppService { }
Best Practices
- Use Auto API Controllers — don't write controllers manually
- Use dynamic client proxies — don't use HttpClient manually
- Prefer static proxies in production
- Add JWT auth in Swagger
- Ensure backward compatibility with API versioning
Related
DDD · UI · Microservices · Authorization · Docs: https://abp.io/docs/latest/framework/api-development