Comments (6)
This is supported in 4.x release, I believe. We now have native ActionResult and ActionResult options with the fluent generic base class, as well as ability to just use the base class directly with whatever signature you want.
from apiendpoints.
You can use WithoutResponse
for this (misleading name in this case, but it will work).
This will create a Task<ActionResult>
method that is able to return CreatedAtRoute
.
PS: I think, WithoutResponse
should really be named WithActionResponse
(or WithActionResult
), and WithoutResponse
should result in Task
method (without type argument).
from apiendpoints.
Haven't tried this yet, but even if that does work, how do you resolve the route argument to point to the get route for getting the data from the POST (i.e. GetPatient
)?
from apiendpoints.
Didn't quite understand you there, but
return CreatedAtRoute("GetPatient",
new { commandResponse.PatientId },
response);
will work, if that's what you asking.
from apiendpoints.
Didn't quite understand you there, but
return CreatedAtRoute("GetPatient", new { commandResponse.PatientId }, response);will work, if that's what you asking.
This was more of a follow up.
I don't have a chance to try it right now, but last I remember it didn't work because it doesn't know where GetPatient
is and I still don't see how it could know, unless ApiEndpoint has some key mapping under the hood across all routes. The only way this currently works to my knowledge is if is this POST is in the same controller as GetPatient
from apiendpoints.
Can you show how GetPatient
controller/action looks? More specifically, what is the route to it and what arguments it accepts.
from apiendpoints.
Related Issues (20)
- Cant read the request body using StreamReader HOT 5
- Swagger documentation in separate class HOT 2
- add consumes/ produces attribute
- Update docs with vs code tip per this exchange
- Docs : Add support to filters by module
- Transitive dependency `Microsoft.NETCore.Platforms.3.1.4` contains vulnerabilities according
- Using `.` in Swagger OperationIds makes swagger client generators fail HOT 2
- Update GitHub project to set project website to https://apiendpoints.ardalis.com HOT 2
- 2 Values from Route failed HOT 2
- Visual Studio 2022 Endpoint Explorer Integration HOT 15
- Unable to control OpenAPI operation ID with ApiExplorerSettings
- Allow for multiple parameters on an endpoint HOT 1
- Example on how to tackle Duplicate Code in Endpoints HOT 1
- Minimal Apis HOT 1
- Update Getting Started section HOT 1
- how to support OData queries and APIVersion? HOT 1
- Get Payload in body as well as the uploaded File
- .NET 8.0 & Libraries
- Add sample / improve docs when starting with an empty web api project HOT 2
- Ability to have RequestBody object, but also Request Query. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apiendpoints.