Questions tagged [minimal-apis]

Minimal APIs were introduced in ASP.NET Core 6 and are architected to create HTTP APIs with minimal dependencies. They are ideal for microservices and apps that want to include only the minimum files, features, and dependencies in ASP.NET Core.

Minimal APIs were introduced in ASP.NET Core 6 and are architected to create HTTP APIs with minimal dependencies. They are ideal for microservices and apps that want to include only the minimum files, features, and dependencies in ASP.NET Core.

Answers for many question can be found in the documentation.

236 questions
1
vote
1 answer

How to evolve an ASP.NET Core Minimal APIs to a full controller model

My teacher told today that Minimal API allow start with minimal code and evolve the application with time in a way you end having a Controller folder and automatic routing as an traditional ASP.NET Coree MVC app/API. I loved the idea of fast…
1
vote
4 answers

ASP.NET Core 6.0 - Minimal APIs: What is the proper way to bind json body request to desired class?

I'm developing a very simple REST API using ASP.NET Core 6.0 - Minimal APIs and for one of Post methods, I need to validate the json body of the request. I used System.ComponentModel.DataAnnotations for that purpose and the code is working…
wiki
  • 1,877
  • 2
  • 31
  • 47
1
vote
1 answer

How to implement Response Caching with Minimal APIs in .NET 6?

In order to implement response caching, all that is needed to be done was: inject .AddResponseCaching() into the services, decorate a controller action with [ResponseCache(Duration = 10)]. Now I'm trying the minimal APIs that come with .NET 6 and…
konkri
  • 186
  • 2
  • 12
0
votes
0 answers

mysterious bug between c# minimal api & nodejs & react-native

Something is really weird happening on my development setup. I am developing for IOS but using react-native but something is happening which is weird. If I boot the app in my device, and try to fetch the localhost (192.168.10.180) in my computer in…
thelittlemaster
  • 157
  • 1
  • 8
0
votes
0 answers

How do I secure a minimal API project called from Blazor client-side using bearer token?

I am used to using Blazor server-side, where (basically) all the action happens on the server, so you don't need to expose APIs that need securing. I'm now exploring client-side Blazor (ie WASM), and am looking at using minimal APIs to provide the…
0
votes
1 answer

How to log application insights and read configuration in common class library in minimal api net7

I'm new to minimal api net7 .I want to log the application insights when any exception raise and read the configuration from app.settings.json in another common library. here i'm using the concept of endpoints to segregate the minimal api net7. here…
0
votes
0 answers

Error when sending firebase-messaging push notifications

Good afternoon, I can't send push notifications when starting the server on a remote PC. On local PC everything works and push notifications are successfully processed and sent. But when I run the .exe of my minimal API on the remote server, I get…
0
votes
1 answer

Minimal API authentication based getting data

I am setting up an authentication and authorization for my minimal API (.Net 7) using this tutorial: https://www.telerik.com/blogs/authorization-authentication-minimal-apis I have never done this before and I am curious if my idea is correct or not.…
0
votes
0 answers

Minimal API service deployed to IIS does not work

I have a minimal api service deployed to IIS using Azure DevOps pipeline. As the service does not work as expected (500 - Internal server error), I checked the IIS. I see that app settings cannot be read. IIS can see only the automatically generated…
David Shochet
  • 5,035
  • 11
  • 57
  • 105
0
votes
1 answer

How to write a RestFUL client to receive a Results.File?

The minimal API was written as below. How can I write a client (something like a proxy) to download the file and then forward the content to another WebAPI server? app.MapGet("/myapi", () => { FileStream fs = File.OpenRead("my.jpg"); return…
s k
  • 4,342
  • 3
  • 42
  • 61
0
votes
0 answers

JsonPatchDocument problems with Minimal API in .NET6 / 7 parameter Json problems

Struggling to get MapPatch to work with minimal API and JsonPatchDocument. The result when passing in a valid json PATCH object is always 'Failed to read parameter "JsonPatchDocument patchDocument" from the request body as JSON' and 'The JSON value…
0
votes
0 answers

Mock "Negotiate" authentication in .NET 6/7

I've been following the official documentation to mock the authorization service, and it seems to be working perfectly when using JWTBearer authentication, but it returns a 500 status code when I try using Negotiate instead. Working…
0
votes
1 answer

How to get current endpoint name into the .NET Minimal API filter?

I'm currently working with a minimal API in C# and I'm using various extension methods to configure endpoints. In my specific case, I have an endpoint defined like this: app.MapGet("/newweatherforecast", () => { var forecast =…
Hardipsinh Jadeja
  • 1,180
  • 1
  • 13
  • 30
0
votes
1 answer

Uploading File and data with minimal API

I'm new to web development generally but I'm creating a file repository that uses minimal APIs. I need to store customer files in silos so need to pass a TenantID in to choose the storage location. It all works fine in the Swagger UI - albeit with a…
MisterA
  • 43
  • 6
0
votes
2 answers

ASP.Net Core API writing files to filestore

I'm developing a document repository using a .net core api project targeted for .net 7 and with minimal API. As a stopgap the uploaded files will be persisted as files to locally attached server filestore. Uploading files to the server as IFormFile…