Let’s say I have two endpoints:
[HttpGet ("{serialNumber}")]
and
[HttpGet ("summary")].
As a result, my application perceives api/summary as api/{serialNumber} where {serialNumber} = "summary" and I get the wrong behavior that I want.
Let’s say I have two endpoints:
[HttpGet ("{serialNumber}")]
and
[HttpGet ("summary")].
As a result, my application perceives api/summary as api/{serialNumber} where {serialNumber} = "summary" and I get the wrong behavior that I want.
2
Answers
the only way to resolve it you have to add action name in the route
I tried it on my machine with different sdks: net3.1, .net5 and .net6
… working as expected.
If I now call
/values/summary
the result iselse if I call
/values/abcde
the result isSo in my opinion if you never have a
{serialNumber} == 'summary'
this APIs should work in the correct way.If you have possibly the case of a
'summary' == {serialNumber}
use explicit endpoints instead like described before (@Serge).